fs/FileSystem: merge CheckAccess() into PathExists()
PathExists() should better do what CheckAccess() does, and CheckAccess() doesn't do what its name implies.
This commit is contained in:
@@ -122,20 +122,6 @@ CheckAccess(Path path, int mode)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Checks is specified path exists and accessible.
|
||||
*/
|
||||
static inline bool
|
||||
CheckAccess(Path path)
|
||||
{
|
||||
#ifdef WIN32
|
||||
struct stat buf;
|
||||
return StatFile(path, buf);
|
||||
#else
|
||||
return CheckAccess(path, F_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if #Path exists and is a regular file.
|
||||
*/
|
||||
@@ -160,10 +146,14 @@ DirectoryExists(Path path, bool follow_symlinks = true)
|
||||
* Checks if #Path exists.
|
||||
*/
|
||||
static inline bool
|
||||
PathExists(Path path, bool follow_symlinks = true)
|
||||
PathExists(Path path)
|
||||
{
|
||||
#ifdef WIN32
|
||||
struct stat buf;
|
||||
return StatFile(path, buf, follow_symlinks);
|
||||
return StatFile(path, buf);
|
||||
#else
|
||||
return CheckAccess(path, F_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user