diff options
Diffstat (limited to 'lib/System/Win32/Path.inc')
-rw-r--r-- | lib/System/Win32/Path.inc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index b9132da7f7..6c80834ad7 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -195,12 +195,18 @@ Path::GetUserHomeDirectory() { bool Path::isFile() const { - return (isValid() && path[path.length()-1] != '/'); + WIN32_FILE_ATTRIBUTE_DATA fi; + if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) + ThrowError(std::string(path) + ": Can't get status: "); + return fi.dwFileAttributes & FILE_ATTRIBUTE_NORMAL; } bool Path::isDirectory() const { - return (isValid() && path[path.length()-1] == '/'); + WIN32_FILE_ATTRIBUTE_DATA fi; + if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) + ThrowError(std::string(path) + ": Can't get status: "); + return fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; } std::string |