mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-13 08:35:46 +00:00
Added "isDirectory" method to llvm::sys::Path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
636e5a216c
commit
fd52711675
@ -321,7 +321,7 @@ namespace sys {
|
|||||||
/// shared library.
|
/// shared library.
|
||||||
/// @brief Determine if the path reference a dynamic library.
|
/// @brief Determine if the path reference a dynamic library.
|
||||||
bool isDynamicLibrary() const;
|
bool isDynamicLibrary() const;
|
||||||
|
|
||||||
/// This function determines if the path name references an existing file
|
/// This function determines if the path name references an existing file
|
||||||
/// or directory in the file system.
|
/// or directory in the file system.
|
||||||
/// @returns true if the pathname references an existing file or
|
/// @returns true if the pathname references an existing file or
|
||||||
@ -330,6 +330,12 @@ namespace sys {
|
|||||||
/// the file system.
|
/// the file system.
|
||||||
bool exists() const;
|
bool exists() const;
|
||||||
|
|
||||||
|
/// This function determines if the path name refences an
|
||||||
|
/// existing directory.
|
||||||
|
/// @returns true if the pathname references an existing directory.
|
||||||
|
/// @brief Determins if the path is a directory in the file system.
|
||||||
|
bool isDirectory() const;
|
||||||
|
|
||||||
/// This function determines if the path name references a readable file
|
/// This function determines if the path name references a readable file
|
||||||
/// or directory in the file system. This function checks for
|
/// or directory in the file system. This function checks for
|
||||||
/// the existence and readability (by the current program) of the file
|
/// the existence and readability (by the current program) of the file
|
||||||
|
@ -288,6 +288,14 @@ Path::exists() const {
|
|||||||
return 0 == access(path.c_str(), F_OK );
|
return 0 == access(path.c_str(), F_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Path::isDirectory() const {
|
||||||
|
struct stat buf;
|
||||||
|
if (0 != stat(path.c_str(), &buf))
|
||||||
|
return false;
|
||||||
|
return buf.st_mode & S_IFDIR ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::canRead() const {
|
Path::canRead() const {
|
||||||
return 0 == access(path.c_str(), F_OK | R_OK );
|
return 0 == access(path.c_str(), F_OK | R_OK );
|
||||||
|
@ -253,6 +253,13 @@ Path::exists() const {
|
|||||||
return attr != INVALID_FILE_ATTRIBUTES;
|
return attr != INVALID_FILE_ATTRIBUTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Path::isDirectory() const {
|
||||||
|
DWORD attr = GetFileAttributes(path.c_str());
|
||||||
|
return (attr != INVALID_FILE_ATTRIBUTES) &&
|
||||||
|
(attr & FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Path::canRead() const {
|
Path::canRead() const {
|
||||||
// FIXME: take security attributes into account.
|
// FIXME: take security attributes into account.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user