diff options
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/Src/FileUtil.cpp | 22 |
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 |
