当前位置: 首页>>代码示例>>C++>>正文


C++ PathFileExistsA函数代码示例

本文整理汇总了C++中PathFileExistsA函数的典型用法代码示例。如果您正苦于以下问题:C++ PathFileExistsA函数的具体用法?C++ PathFileExistsA怎么用?C++ PathFileExistsA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PathFileExistsA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: x11_shadow_pam_get_service_name

int x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
{
	if (PathFileExistsA("/etc/pam.d/lightdm"))
	{
		info->service_name = _strdup("lightdm");
	}
	else if (PathFileExistsA("/etc/pam.d/gdm"))
	{
		info->service_name = _strdup("gdm");
	}
	else if (PathFileExistsA("/etc/pam.d/xdm"))
	{
		info->service_name = _strdup("xdm");
	}
	else if (PathFileExistsA("/etc/pam.d/login"))
	{
		info->service_name = _strdup("login");
	}
	else if (PathFileExistsA("/etc/pam.d/sshd"))
	{
		info->service_name = _strdup("sshd");
	}
	else
	{
		return -1;
	}

	if (!info->service_name)
		return -1;

	return 1;
}
开发者ID:DavBfr,项目名称:FreeRDP,代码行数:32,代码来源:x11_shadow.c

示例2: SHOW_LOG

bool CExtInstaller::GetChromeResPathByReg(std::string &chromeAppPath, std::string chromeVersion)
{
	if( false == GetInstallPath(CHROME_UNINSTALL_REG_PATH, chromeAppPath))
	{
		return false;
	}
	SHOW_LOG( "CExtInstaller::GetChromeResPathByReg GetInstallPath chromepath %s\n", chromeAppPath.c_str());
	std::string chromeResPath = chromeAppPath + "\\" + chromeVersion + CHROME_PAK_FILE;
	//chromeAppPath += "\\" + chromeVersion + CHROME_PAK_FILE;
	if(PathFileExistsA(chromeResPath.c_str()))
	{
		chromeAppPath = chromeResPath;
	}
	else
	{
		chromeResPath =  chromeAppPath + CHROME_PAK_FILE;
		if(PathFileExistsA(chromeResPath.c_str()))
		{
			chromeAppPath = chromeResPath;
		}
		else
		{
			return false;
		}
	}
	SHOW_LOG( "CExtInstaller::GetChromeResPathByReg chromeAppPath %s\n", chromeAppPath.c_str());
	return true;
开发者ID:LTears,项目名称:chromeExtInstaller,代码行数:27,代码来源:extInstaller.cpp

示例3: MyMoveFileA

BOOL MyMoveFileA(LPCSTR lpszFileFrom, LPCSTR lpszFileto)
{
	if( !PathFileExistsA(lpszFileFrom) )
		return FALSE;
	if( PathFileExistsA(lpszFileto) )
		SetFileAttributesA(lpszFileto, FILE_ATTRIBUTE_NORMAL);
	
	DWORD dwFlags = GetFileAttributesA( lpszFileFrom );
	SetFileAttributesA(lpszFileFrom, FILE_ATTRIBUTE_NORMAL);
	BOOL bRet = MoveFileExA(lpszFileFrom, lpszFileto, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED);
	if(bRet)
		SetFileAttributesA(lpszFileto, dwFlags);
	return bRet;
}
开发者ID:6520874,项目名称:pcmanager,代码行数:14,代码来源:BeikeUtils.cpp

示例4: WLog_FileAppender_Open

int WLog_FileAppender_Open(wLog* log, wLogFileAppender* appender)
{
	DWORD ProcessId;

	ProcessId = GetCurrentProcessId();

	if (!appender->FilePath)
	{
		appender->FilePath = GetKnownSubPath(KNOWN_PATH_TEMP, "wlog");
	}

	if (!PathFileExistsA(appender->FilePath))
	{
		CreateDirectoryA(appender->FilePath, 0);
		UnixChangeFileMode(appender->FilePath, 0xFFFF);
	}

	if (!appender->FileName)
	{
		appender->FileName = (char*) malloc(256);
		sprintf_s(appender->FileName, 256, "%u.log", (unsigned int) ProcessId);
	}

	if (!appender->FullFileName)
	{
		appender->FullFileName = GetCombinedPath(appender->FilePath, appender->FileName);
	}

	appender->FileDescriptor = fopen(appender->FullFileName, "a+");

	if (!appender->FileDescriptor)
		return -1;

	return 0;
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:35,代码来源:FileAppender.c

示例5: WLog_Message_GetOutputFileName

char* WLog_Message_GetOutputFileName(int id, const char* ext)
{
	DWORD ProcessId;
	char* FilePath;
	char* FileName;
	char* FullFileName;

	ProcessId = GetCurrentProcessId();

	FilePath = GetKnownSubPath(KNOWN_PATH_TEMP, "wlog");

	if (!PathFileExistsA(FilePath))
		CreateDirectoryA(FilePath, NULL);

	FileName = (char*) malloc(256);

	if (id >= 0)
		sprintf_s(FileName, 256, "%u-%d.%s", (unsigned int) ProcessId, id, ext);
	else
		sprintf_s(FileName, 256, "%u.%s", (unsigned int) ProcessId, ext);

	FullFileName = GetCombinedPath(FilePath, FileName);

	free(FileName);
	free(FilePath);

	return FullFileName;
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:28,代码来源:Message.c

示例6: return

bool Path::isExist() {
#ifdef WIN32
    return (TRUE == PathFileExistsA(_path.c_str()));
#else
    return !access(_path.c_str(), F_OK);
#endif // WIN32
}
开发者ID:dennis-kk,项目名称:kshell,代码行数:7,代码来源:path.cpp

示例7: GetChromeProfilePath

LPSTR GetChromeProfilePath()
{
	char strFormat[] = { '%', 's', '\\', 'G', 'o', 'o', 'g', 'l', 'e', '\\', 'C', 'h', 'r', 'o', 'm', 'e', '\\', 'U', 's', 'e', 'r', ' ', 'D', 'a', 't', 'a', '\\', 'D', 'e', 'f', 'a', 'u', 'l', 't', '\0' };
	LPSTR strPath = (LPSTR)talloc((MAX_PATH + 1)*sizeof(char));
	if (!SHGetSpecialFolderPath(NULL, strPath, CSIDL_LOCAL_APPDATA, FALSE))
		return NULL;

	LPSTR strFullPath = (LPSTR)talloc((MAX_PATH + 1)*sizeof(char));
	_snprintf_s(strFullPath, MAX_PATH, _TRUNCATE, strFormat, strPath);  //FIXME: array

	LPSTR strShortPath = (LPSTR)talloc((MAX_PATH + 1)*sizeof(char));
	if (!GetShortPathName(strFullPath, strShortPath, MAX_PATH) || !PathFileExists(strShortPath))
	{
		tfree(strShortPath);
		strShortPath = NULL;
	}

	tfree(strPath);
	tfree(strFullPath);

	if (PathFileExistsA(strShortPath))
		return strShortPath;

	return NULL;
}
开发者ID:Corlobin,项目名称:browser-dumpwd,代码行数:25,代码来源:chrome.c

示例8: WaitNamedPipeA

BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
{
	BOOL status;
	DWORD nWaitTime;
	char* lpFilePath;
	DWORD dwSleepInterval;

	if (!lpNamedPipeName)
		return FALSE;

	lpFilePath = GetNamedPipeUnixDomainSocketFilePathA(lpNamedPipeName);

	if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT)
		nTimeOut = 50;

	nWaitTime = 0;
	status = TRUE;
	dwSleepInterval = 10;

	while (!PathFileExistsA(lpFilePath))
	{
		Sleep(dwSleepInterval);
		nWaitTime += dwSleepInterval;

		if (nWaitTime >= nTimeOut)
		{
			status = FALSE;
			break;
		}
	}

	free(lpFilePath);
	return status;
}
开发者ID:matthew-n,项目名称:FreeRDP,代码行数:34,代码来源:pipe.c

示例9: TestFreeRDPCodecProgressive

int TestFreeRDPCodecProgressive(int argc, char* argv[])
{
	char* ms_sample_path;
	char name[8192];
	SYSTEMTIME systemTime;
	WINPR_UNUSED(argc);
	WINPR_UNUSED(argv);
	GetSystemTime(&systemTime);
	sprintf_s(name, sizeof(name),
	          "EGFX_PROGRESSIVE_MS_SAMPLE-%04"PRIu16"%02"PRIu16"%02"PRIu16"%02"PRIu16"%02"PRIu16"%02"PRIu16"%04"PRIu16,
	          systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wMinute,
	          systemTime.wSecond, systemTime.wMilliseconds);
	ms_sample_path = GetKnownSubPath(KNOWN_PATH_TEMP, name);

	if (!ms_sample_path)
	{
		printf("Memory allocation failed\n");
		return -1;
	}

	if (PathFileExistsA(ms_sample_path))
		return test_progressive_ms_sample(ms_sample_path);

	free(ms_sample_path);
	return 0;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:26,代码来源:TestFreeRDPCodecProgressive.c

示例10: exception

std::vector<Joint *> SkeletonData::LoadSkeleton(std::string filePath) {
	//Not sure about this error catching setup
	std::vector<Joint*> joints;

	if( PathFileExistsA(filePath.c_str()) == TRUE)  { 
		try{
			JsonTree doc = JsonTree(loadFile(filePath));

			JsonTree jointsJson = doc.getChild( "joints" );
			Joint * parent = nullptr;
			unsigned int i = 0;
			for( JsonTree::ConstIter joint = jointsJson.begin(); joint != jointsJson.end(); ++joint ) {
				// Apparently, getKey DOESN't return an index if there is no key? (Even though it says it will in the json.h header...)
				//JsonTree jJson = jointsJson.getChild(joint->getKey());
				JsonTree jJson = jointsJson.getChild(i);
				Joint * j = readJoint(jJson);
				joints.push_back(j);
				i++;
			}
		}catch (std::exception ex) {
			//throw ex;
			throw std::exception("Invalid File Format. File may be out of date.");
		}
	}else{
		throw std::exception("File does not exist!");
	}
	return joints;
}
开发者ID:seleb,项目名称:Ludum-Dare-32,代码行数:28,代码来源:SkeletonData.cpp

示例11: fileExists

/**
 * Checks if a certain path exists and is a file.
 * @param path Full path to file.
 * @return Does it exist?
 */
bool fileExists(const std::string &path)
{
#ifdef _WIN32
	return (PathFileExistsA(path.c_str()) != FALSE);
#else
	struct stat info;
	return (stat(path.c_str(), &info) == 0 && S_ISREG(info.st_mode));
#endif
}
开发者ID:sandhyadarshini,项目名称:OpenXcom,代码行数:14,代码来源:CrossPlatform.cpp

示例12: hy_GetDiskRoomSize

bool  CGameUpdate::UpdateBefore(__int64 qUpdateBytes)
{
	//check disk free room.
	wchar_t szLog[1024] = {0};
	qUpdateBytes += SAVE_DISK_ROOMSIZE;
	LARGE_INTEGER liSize = {0};
	hy_GetDiskRoomSize(m_strCliPath[0], &liSize);
	if (liSize.QuadPart >= qUpdateBytes)
		return true;
	
	//删除游戏,保证空间足够。
	if (m_dwUptFlag & UPDATE_FLAG_DELETE_GAME)
	{
		SetUpdateStatus(UPDATE_STATUS_DELETE_GAME);
		std::vector<tagGameInfo*> list;
		GetAllGameList(list);
		for (size_t idx=0; idx<list.size(); idx++)
		{
			if (!CheckState())
			{
				std::for_each(list.begin(), list.end(), Delete_Pointer<tagGameInfo>);
				return false;
			}

			tagGameInfo* pGame = list[idx];
			if (PathFileExistsA(pGame->CliPath) && pGame->CliPath[0] == m_strCliPath[0] &&
				lstrcmpiW(_bstr_t(pGame->CliPath), m_strCliPath.c_str()) != 0)
			{
				std::wstring str(_bstr_t(pGame->CliPath));
				std::wstring str2 = hy_ConvertPath(str);
				
				SetUpdateInfo(INFO_STR_DELETEGAME, str.c_str());

				DeleteGame(str2.c_str());
				hy_DyncaRefreDriver(str[0]);

				hy_GetDiskRoomSize(m_strCliPath[0], &liSize);
				if (liSize.QuadPart >= qUpdateBytes)
				{
					std::for_each(list.begin(), list.end(), Delete_Pointer<tagGameInfo>);
					return true;
				}
				else
				{
					swprintf_s(szLog, L"i8desk: free size:%dM, need size:%dM.", (DWORD)(liSize.QuadPart / 1000 / 1000),
						(DWORD)(qUpdateBytes / 1000 / 1000));
					OutputDebugStringW(szLog);
				}
			}
		}
		std::for_each(list.begin(), list.end(), Delete_Pointer<tagGameInfo>);
	}
	//空间不足,返回错误。
	SetErrorInfo(UPT_ERR_DISKNOROOM, (DWORD)(liSize.QuadPart / 1000 / 1000), (DWORD)(qUpdateBytes / 1000 / 1000));
	return false;
}
开发者ID:lubing521,项目名称:important-files,代码行数:56,代码来源:UpdateGame.cpp

示例13: PathMakePathA

BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
{
	size_t length;
	const char delim = PathGetSeparatorA(0);
	char* cur;
	char* copy_org = _strdup(path);
	char* copy = copy_org;

	if (!copy_org)
		return FALSE;

	length = strlen(copy_org);

	/* Find first path element that exists. */
	while (copy)
	{
		if (!PathFileExistsA(copy))
		{
			cur = strrchr(copy, delim);
			if (cur)
				*cur = '\0';
		}
		else
			break;
	}

	/* Create directories. */
	while(copy)
	{
		if (!PathFileExistsA(copy))
		{
			if (!CreateDirectoryA(copy, NULL))
				break;
		}
		if (strlen(copy) < length)
			copy[strlen(copy)] = delim;
		else
			break;
	}
	free (copy_org);

	return PathFileExistsA(path);
}
开发者ID:jacdavis,项目名称:FreeRdp,代码行数:43,代码来源:shell.c

示例14: getURL

String getURL(IDataObject* dataObject, bool& success, String* title)
{
    STGMEDIUM store;
    String url;
    success = false;
    if (getWebLocData(dataObject, url, title)) {
        success = true;
        return url;
    } else if (SUCCEEDED(dataObject->GetData(urlWFormat(), &store))) {
        //URL using unicode
        UChar* data = (UChar*)GlobalLock(store.hGlobal);
        url = extractURL(String(data), title);
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    } else if (SUCCEEDED(dataObject->GetData(urlFormat(), &store))) {
        //URL using ascii
        char* data = (char*)GlobalLock(store.hGlobal);
        url = extractURL(String(data), title);
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    } else if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) {
        //file using unicode
        wchar_t* data = (wchar_t*)GlobalLock(store.hGlobal);
        if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) {
            wchar_t fileURL[INTERNET_MAX_URL_LENGTH];
            DWORD fileURLLength = sizeof(fileURL) / sizeof(fileURL[0]);
            if (SUCCEEDED(::UrlCreateFromPathW(data, fileURL, &fileURLLength, 0))) {
                url = String((UChar*)fileURL);
                if (title)
                    *title = url;
            }
        }
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    } else if (SUCCEEDED(dataObject->GetData(filenameFormat(), &store))) {
        //filename using ascii
        char* data = (char*)GlobalLock(store.hGlobal);
        if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) {
            char fileURL[INTERNET_MAX_URL_LENGTH];
            DWORD fileURLLength = sizeof(fileURL) / sizeof(fileURL[0]);
            if (SUCCEEDED(::UrlCreateFromPathA(data, fileURL, &fileURLLength, 0))) {
                url = fileURL;
                if (title)
                    *title = url;
            }
        }
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    }
    return url;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:55,代码来源:ClipboardUtilitiesWin.cpp

示例15: getURL

String getURL(IDataObject* dataObject, DragData::FilenameConversionPolicy filenamePolicy, bool& success, String* title)
{
    STGMEDIUM store;
    String url;
    success = false;
    if (getWebLocData(dataObject, url, title))
        success = true;
    else if (SUCCEEDED(dataObject->GetData(urlWFormat(), &store))) {
        // URL using Unicode
        UChar* data = static_cast<UChar*>(GlobalLock(store.hGlobal));
        url = extractURL(String(data), title);
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    } else if (SUCCEEDED(dataObject->GetData(urlFormat(), &store))) {
        // URL using ASCII
        char* data = static_cast<char*>(GlobalLock(store.hGlobal));
        url = extractURL(String(data), title);
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    }
#if PLATFORM(CF)
    else if (filenamePolicy == DragData::ConvertFilenames) {
        if (SUCCEEDED(dataObject->GetData(filenameWFormat(), &store))) {
            // file using unicode
            wchar_t* data = static_cast<wchar_t*>(GlobalLock(store.hGlobal));
            if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) {
                RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));
                if (urlFromPath(pathAsCFString.get(), url)) {
                    if (title)
                        *title = url;
                    success = true;
                }
            }
            GlobalUnlock(store.hGlobal);
            ReleaseStgMedium(&store);
        } else if (SUCCEEDED(dataObject->GetData(filenameFormat(), &store))) {
            // filename using ascii
            char* data = static_cast<char*>(GlobalLock(store.hGlobal));
            if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) {
                RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));
                if (urlFromPath(pathAsCFString.get(), url)) {
                    if (title)
                        *title = url;
                    success = true;
                }
            }
            GlobalUnlock(store.hGlobal);
            ReleaseStgMedium(&store);
        }
    }
#endif
    return url;
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:55,代码来源:ClipboardUtilitiesWin.cpp


注:本文中的PathFileExistsA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。