mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-15 16:09:57 +00:00
API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b3587cfb3b
commit
e49a8e4db9
@ -380,10 +380,12 @@ namespace sys {
|
|||||||
/// in the file system.
|
/// in the file system.
|
||||||
bool canWrite() const;
|
bool canWrite() const;
|
||||||
|
|
||||||
/// This function checks that what we're trying to work only on a regular file or directory.
|
/// This function checks that what we're trying to work only on a regular file
|
||||||
/// Check for things like /dev/null, any block special file,
|
/// or directory. Check for things like /dev/null, any block special file,
|
||||||
/// or other things that aren't "regular" regular files or directories.
|
/// or other things that aren't "regular" regular files or directories.
|
||||||
bool isSpecialFile() const;
|
/// @returns true if the file is S_ISREG.
|
||||||
|
/// @brief Determines if the file is a regular file
|
||||||
|
bool isRegularFile() const;
|
||||||
|
|
||||||
/// This function determines if the path name references an executable
|
/// This function determines if the path name references an executable
|
||||||
/// file in the file system. This function checks for the existence and
|
/// file in the file system. This function checks for the existence and
|
||||||
|
@ -454,17 +454,17 @@ Path::canWrite() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isSpecialFile() const {
|
Path::isRegularFile() const {
|
||||||
// Get the status so we can determine if its a file or directory
|
// Get the status so we can determine if its a file or directory
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
if (0 != stat(path.c_str(), &buf))
|
if (0 != stat(path.c_str(), &buf))
|
||||||
return true;
|
|
||||||
|
|
||||||
if (S_ISDIR(buf.st_mode) || S_ISREG(buf.st_mode))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
if (S_ISREG(buf.st_mode))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -358,8 +358,10 @@ Path::canExecute() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::isSpecialFile() const {
|
Path::isRegularFile() const {
|
||||||
return false;
|
if (isDirectory())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
|
Loading…
Reference in New Issue
Block a user