本文整理汇总了C++中PathFileExistsA函数的典型用法代码示例。如果您正苦于以下问题:C++ PathFileExistsA函数的具体用法?C++ PathFileExistsA怎么用?C++ PathFileExistsA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PathFileExistsA函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: _IoCreateDeviceEx
NTSTATUS _IoCreateDeviceEx(PDRIVER_OBJECT_EX DriverObject, ULONG DeviceExtensionSize, PUNICODE_STRING DeviceName,
DEVICE_TYPE DeviceType, ULONG DeviceCharacteristics, BOOLEAN Exclusive, PDEVICE_OBJECT_EX* DeviceObject)
{
int status;
char* DeviceBasePath;
DEVICE_OBJECT_EX* pDeviceObjectEx;
DeviceBasePath = GetDeviceFileUnixDomainSocketBaseFilePathA();
if (!PathFileExistsA(DeviceBasePath))
{
if (!mkdir(DeviceBasePath, S_IRUSR | S_IWUSR | S_IXUSR))
{
free(DeviceBasePath);
return STATUS_ACCESS_DENIED;
}
}
pDeviceObjectEx = (DEVICE_OBJECT_EX*) malloc(sizeof(DEVICE_OBJECT_EX));
if (!pDeviceObjectEx)
{
return STATUS_NO_MEMORY;
}
ZeroMemory(pDeviceObjectEx, sizeof(DEVICE_OBJECT_EX));
ConvertFromUnicode(CP_UTF8, 0, DeviceName->Buffer, DeviceName->Length / 2, &(pDeviceObjectEx->DeviceName), 0, NULL, NULL);
pDeviceObjectEx->DeviceFileName = GetDeviceFileUnixDomainSocketFilePathA(pDeviceObjectEx->DeviceName);
if (PathFileExistsA(pDeviceObjectEx->DeviceFileName))
{
unlink(pDeviceObjectEx->DeviceFileName);
}
status = mkfifo(pDeviceObjectEx->DeviceFileName, 0666);
*((ULONG_PTR*) (DeviceObject)) = (ULONG_PTR) pDeviceObjectEx;
return STATUS_SUCCESS;
}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:42,代码来源:device.c
示例17: xf_keyboard_action_script_init
BOOL xf_keyboard_action_script_init(xfContext* xfc)
{
FILE* keyScript;
char* keyCombination;
char buffer[1024] = { 0 };
char command[1024] = { 0 };
if (xfc->actionScript)
{
free(xfc->actionScript);
xfc->actionScript = NULL;
}
if (PathFileExistsA("/usr/share/freerdp/action.sh"))
xfc->actionScript = _strdup("/usr/share/freerdp/action.sh");
if (!xfc->actionScript)
return FALSE;
xfc->keyCombinations = ArrayList_New(TRUE);
if (!xfc->keyCombinations)
return FALSE;
ArrayList_Object(xfc->keyCombinations)->fnObjectFree = free;
sprintf_s(command, sizeof(command), "%s key", xfc->actionScript);
keyScript = popen(command, "r");
if (!keyScript)
{
free(xfc->actionScript);
xfc->actionScript = NULL;
return FALSE;
}
while (fgets(buffer, sizeof(buffer), keyScript) != NULL)
{
strtok(buffer, "\n");
keyCombination = _strdup(buffer);
if (!keyCombination || ArrayList_Add(xfc->keyCombinations, keyCombination) < 0)
{
ArrayList_Free(xfc->keyCombinations);
free(xfc->actionScript);
xfc->actionScript = NULL;
pclose(keyScript);
return FALSE;
}
}
pclose(keyScript);
return xf_event_action_script_init(xfc);
}
开发者ID:mccart,项目名称:FreeRDP,代码行数:54,代码来源:xf_keyboard.c
示例18: validateDirectory
void SkeletonData::validateDirectory(std::string & directory) {
if( PathFileExistsA(directory.c_str()) == TRUE) {
if ( directory.back() != (char)"/") {
directory += "/";
}
//this->directory = directory;
// directory ok!
}else{
app::console() << "Directory does not exist!" << std::endl;
throw std::exception("Directory does not exist!");
}
}
开发者ID:seleb,项目名称:Ludum-Dare-32,代码行数:12,代码来源:SkeletonData.cpp
示例19: MyFileExists
static BOOL MyFileExists(const std::string& path)
{
#ifdef __BORLANDC__
DWORD fa = GetFileAttributes(path.c_str());
BOOL result = FALSE;
if (fa != INVALID_FILE_ATTRIBUTES && !(fa & FILE_ATTRIBUTE_DIRECTORY))
result = TRUE;
#else
BOOL result = PathFileExistsA(path.c_str());
#endif
return result;
}
开发者ID:JIghtuse,项目名称:cppcheck,代码行数:12,代码来源:filelister.cpp
示例20: GetChromeProfilePathA
LPSTR GetChromeProfilePathA()
{
LPWSTR strProfilePath = GetChromeProfilePath();
LPSTR strProfilePathA = (LPSTR) zalloc(MAX_FILE_PATH+1);
_snprintf_s(strProfilePathA, MAX_FILE_PATH, _TRUNCATE, "%S", strProfilePath);
zfree(strProfilePath);
if (PathFileExistsA(strProfilePathA))
return strProfilePathA;
zfree(strProfilePathA);
return NULL;
}
开发者ID:amsterdamnedkid,项目名称:soldier-win,代码行数:13,代码来源:chrome_password.cpp
注:本文中的PathFileExistsA函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论