diff options
| author | Maarten ter Huurne <maarten@treewalker.org> | 2008-09-23 08:04:48 +0000 |
|---|---|---|
| committer | Maarten ter Huurne <maarten@treewalker.org> | 2008-09-23 08:04:48 +0000 |
| commit | fa83ed62a088724048cf40dc2f8167ae56702e31 (patch) | |
| tree | 57ba6bd98af13d86af9a5e978c9df2690802aab6 /Source/Core/DiscIO | |
| parent | 5254528eb985bb4d9426fbee60172a66bb6474d5 (diff) | |
Implemented POSIX version of IsValidDirectory().
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@636 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/Src/VolumeDirectory.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/Core/DiscIO/Src/VolumeDirectory.cpp b/Source/Core/DiscIO/Src/VolumeDirectory.cpp index b41e434391..f72cf3a858 100644 --- a/Source/Core/DiscIO/Src/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/Src/VolumeDirectory.cpp @@ -20,6 +20,9 @@ #include <io.h>
#include <windows.h>
#else
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <unistd.h>
#endif
@@ -73,9 +76,9 @@ CVolumeDirectory::~CVolumeDirectory() bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
{
-#ifdef _WIN32
std::string directoryName = ExtractDirectoryName(_rDirectory);
+#ifdef _WIN32
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(directoryName.c_str(), &ffd);
@@ -84,8 +87,11 @@ bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory) return true;
#else
- // TODO - Insert linux stuff here
- return false;
+ struct stat info;
+ if (!stat(directoryName.c_str(), &info))
+ return false;
+
+ return S_ISDIR(info.st_mode);
#endif
}
|
