Implemented POSIX version of IsValidDirectory().
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@636 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
5254528eb9
commit
fa83ed62a0
|
@ -20,6 +20,9 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -73,9 +76,9 @@ CVolumeDirectory::~CVolumeDirectory()
|
||||||
|
|
||||||
bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
|
bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
|
||||||
std::string directoryName = ExtractDirectoryName(_rDirectory);
|
std::string directoryName = ExtractDirectoryName(_rDirectory);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
HANDLE hFind = FindFirstFile(directoryName.c_str(), &ffd);
|
HANDLE hFind = FindFirstFile(directoryName.c_str(), &ffd);
|
||||||
|
|
||||||
|
@ -84,8 +87,11 @@ bool CVolumeDirectory::IsValidDirectory(const std::string& _rDirectory)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
// TODO - Insert linux stuff here
|
struct stat info;
|
||||||
return false;
|
if (!stat(directoryName.c_str(), &info))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return S_ISDIR(info.st_mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue