diff options
| author | nakeee <nakeee@gmail.com> | 2008-09-05 13:12:47 +0000 |
|---|---|---|
| committer | nakeee <nakeee@gmail.com> | 2008-09-05 13:12:47 +0000 |
| commit | 3749fb510bde475ecca768d8597776bcfcce6c08 (patch) | |
| tree | 6a4029a185f1b95183d233b7050c072ff2962d31 /Source/Core/Common/Src/FileUtil.cpp | |
| parent | dc28cbec1cfe0beeab736746fc4d85dcb5702011 (diff) | |
added getuserdirectory
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@444 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/FileUtil.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 6ab7e09531..1d79beef51 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -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);
- return S_ISDIR(file_info.st_mode);
+ 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
+}
|
