mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Create path_is_valid
This commit is contained in:
parent
77d99395a2
commit
9d67d48036
@ -172,15 +172,15 @@ bool path_is_compressed_file(const char* path)
|
|||||||
*/
|
*/
|
||||||
bool path_is_directory(const char *path)
|
bool path_is_directory(const char *path)
|
||||||
{
|
{
|
||||||
#if defined(VITA)
|
#if defined(VITA) || defined(PSP)
|
||||||
SceIoStat buf;
|
SceIoStat buf;
|
||||||
if (sceIoGetstat(path, &buf) < 0)
|
if (sceIoGetstat(path, &buf) < 0)
|
||||||
return -1;
|
return false;
|
||||||
return PSP2_S_ISDIR(buf.st_mode);
|
return PSP2_S_ISDIR(buf.st_mode);
|
||||||
#elif defined(__CELLOS_LV2__)
|
#elif defined(__CELLOS_LV2__)
|
||||||
CellFsStat buf;
|
CellFsStat buf;
|
||||||
if (cellFsStat(path, &buf) < 0)
|
if (cellFsStat(path, &buf) < 0)
|
||||||
return -1;
|
return false;
|
||||||
return ((buf.st_mode & S_IFMT) == S_IFDIR);
|
return ((buf.st_mode & S_IFMT) == S_IFDIR);
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
DWORD ret = GetFileAttributes(path);
|
DWORD ret = GetFileAttributes(path);
|
||||||
@ -194,6 +194,29 @@ bool path_is_directory(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool path_is_valid(const char *path)
|
||||||
|
{
|
||||||
|
#if defined(VITA) || defined(PSP)
|
||||||
|
SceIoStat buf;
|
||||||
|
if (sceIoGetstat(path, &buf) < 0)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
#elif defined(__CELLOS_LV2__)
|
||||||
|
CellFsStat buf;
|
||||||
|
if (cellFsStat(path, &buf) < 0)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
DWORD ret = GetFileAttributes(path);
|
||||||
|
return (ret != INVALID_FILE_ATTRIBUTES);
|
||||||
|
#else
|
||||||
|
struct stat buf;
|
||||||
|
if (stat(path, &buf) < 0)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path_file_exists:
|
* path_file_exists:
|
||||||
* @path : path
|
* @path : path
|
||||||
|
@ -84,6 +84,8 @@ bool path_contains_compressed_file(const char *path);
|
|||||||
*/
|
*/
|
||||||
bool path_is_directory(const char *path);
|
bool path_is_directory(const char *path);
|
||||||
|
|
||||||
|
bool path_is_valid(const char *path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path_file_exists:
|
* path_file_exists:
|
||||||
* @path : path
|
* @path : path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user