added getuserdirectory

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@444 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-09-05 13:12:47 +00:00
parent dc28cbec1c
commit 3749fb510b
2 changed files with 18 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#else
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#endif
bool File::Exists(const std::string &filename)
@ -24,7 +25,10 @@ bool File::IsDirectory(const std::string &filename) {
#else
struct stat file_info;
int result = stat(filename.c_str(), &file_info);
if (result == 0)
return S_ISDIR(file_info.st_mode);
else
return false;
#endif
}
@ -96,3 +100,15 @@ bool File::CreateDir(const std::string &path)
#endif
}
std::string GetUserDirectory() {
#ifdef _WIN32
//TODO #endif
#else
char *dir = getenv("HOME");
if (!dir)
return std::string("");
return dir;
#endif
}

View File

@ -11,6 +11,7 @@ public:
static void Explore(const std::string &path);
static bool IsDirectory(const std::string &filename);
static bool CreateDir(const std::string &filename);
static std::string GetUserDirectory();
};
#endif