diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/System/Unix/Path.inc | 34 | ||||
-rw-r--r-- | lib/System/Win32/Path.inc | 33 |
2 files changed, 0 insertions, 67 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 41349d940e..83885c31b0 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -236,38 +236,6 @@ Path::GetUserHomeDirectory() { return GetRootDirectory(); } -bool -Path::isFile() const { - if (!exists()) - return false; - struct stat buf; - if (stat(path.c_str(), &buf) != 0) { - ThrowErrno(path + ": can't determine type of path object: "); - } - return S_ISREG(buf.st_mode); -} - -bool -Path::isDirectory() const { - if (!exists()) - return false; - struct stat buf; - if (0 != stat(path.c_str(), &buf)) { - ThrowErrno(path + ": can't determine type of path object: "); - } - return S_ISDIR(buf.st_mode); -} - -bool -Path::isHidden() const { - if (!exists()) - return false; - size_t slash = path.rfind('/'); - return (slash != std::string::npos && - slash < path.length()-1 && - path[slash+1] == '.') || - (!path.empty() && slash == std::string::npos && path[0] == '.'); -} std::string Path::getBasename() const { @@ -432,8 +400,6 @@ void Path::makeExecutableOnDisk() { bool Path::getDirectoryContents(std::set<Path>& result) const { - if (!isDirectory()) - return false; DIR* direntries = ::opendir(path.c_str()); if (direntries == 0) ThrowErrno(path + ": can't open directory"); diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index 73432ba69e..8bc39f498d 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -216,39 +216,6 @@ Path::GetUserHomeDirectory() { } // FIXME: the above set of functions don't map to Windows very well. -bool -Path::isFile() const { - WIN32_FILE_ATTRIBUTE_DATA fi; - BOOL rc = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi); - if (rc) - return !(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); - else if (GetLastError() != ERROR_FILE_NOT_FOUND) { - ThrowError("isFile(): " + std::string(path) + ": Can't get status: "); - } - return false; -} - -bool -Path::isDirectory() const { - WIN32_FILE_ATTRIBUTE_DATA fi; - BOOL rc = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi); - if (rc) - return fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; - else if (GetLastError() != ERROR_FILE_NOT_FOUND) - ThrowError("isDirectory(): " + std::string(path) + ": Can't get status: "); - return false; -} - -bool -Path::isHidden() const { - WIN32_FILE_ATTRIBUTE_DATA fi; - BOOL rc = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi); - if (rc) - return fi.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN; - else if (GetLastError() != ERROR_FILE_NOT_FOUND) - ThrowError("isHidden(): " + std::string(path) + ": Can't get status: "); - return false; -} bool Path::isRootDirectory() const { |