summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/FileUtil.cpp
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2008-07-20 21:20:22 +0000
committerhrydgard <hrydgard@gmail.com>2008-07-20 21:20:22 +0000
commit36f8b9751a5de8548e6ed1f0d62035dd5f54a761 (patch)
tree5c8c66c89f76eab339c8d4fcf9c06d14517e4aba /Source/Core/Common/Src/FileUtil.cpp
parent4175db3aa39f1b2536cac546a0d6c8f161bf108f (diff)
Better error messages, Dolphin will create save directories if not present.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@37 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index f8d9b565ff..2c14db9ab1 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -51,3 +51,25 @@ void File::Explore(const std::string &path)
ShellExecuteEx(&shex);
#endif
}
+
+// Returns true if successful, or path already exists.
+bool File::CreateDir(const std::string &path)
+{
+#ifdef _WIN32
+ if (::CreateDirectory(path.c_str(), NULL))
+ {
+ return true;
+ }
+ else
+ {
+ DWORD error = GetLastError();
+ if (error == ERROR_ALREADY_EXISTS)
+ {
+ PanicAlert("%s already exists", path.c_str());
+ return true;
+ }
+ PanicAlert("Error creating directory: %i", error);
+ return false;
+ }
+#endif
+} \ No newline at end of file