mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 21:35:28 +00:00
added getuserdirectory
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@444 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
dc28cbec1c
commit
3749fb510b
@ -5,6 +5,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool File::Exists(const std::string &filename)
|
bool File::Exists(const std::string &filename)
|
||||||
@ -24,7 +25,10 @@ bool File::IsDirectory(const std::string &filename) {
|
|||||||
#else
|
#else
|
||||||
struct stat file_info;
|
struct stat file_info;
|
||||||
int result = stat(filename.c_str(), &file_info);
|
int result = stat(filename.c_str(), &file_info);
|
||||||
return S_ISDIR(file_info.st_mode);
|
if (result == 0)
|
||||||
|
return S_ISDIR(file_info.st_mode);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,3 +100,15 @@ bool File::CreateDir(const std::string &path)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetUserDirectory() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
//TODO #endif
|
||||||
|
#else
|
||||||
|
char *dir = getenv("HOME");
|
||||||
|
if (!dir)
|
||||||
|
return std::string("");
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -11,6 +11,7 @@ public:
|
|||||||
static void Explore(const std::string &path);
|
static void Explore(const std::string &path);
|
||||||
static bool IsDirectory(const std::string &filename);
|
static bool IsDirectory(const std::string &filename);
|
||||||
static bool CreateDir(const std::string &filename);
|
static bool CreateDir(const std::string &filename);
|
||||||
|
static std::string GetUserDirectory();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user