summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/FileUtil.cpp
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2008-09-07 10:29:46 +0000
committerhrydgard <hrydgard@gmail.com>2008-09-07 10:29:46 +0000
commit5a69fca0be4c00267a0e8c4fbbb4b6bdafe7213d (patch)
treea55106a1565226fe72ec5d90166e8ef5a54be0dd /Source/Core/Common/Src/FileUtil.cpp
parent5ac0c33530b1e9362d7c002b838179da89de1d03 (diff)
Add some missing GPL headers, fix building with Platform SDK 6.0, delete unused HTTP code.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@452 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp54
1 files changed, 39 insertions, 15 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index ad19778902..061f51ea5a 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -1,8 +1,29 @@
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
#include "Common.h"
#include "FileUtil.h"
+
#ifdef _WIN32
+#include <shlobj.h> // for SHGetFolderPath
#include <shellapi.h>
+#include <commdlg.h> // for GetSaveFileName
#else
+
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
@@ -85,17 +106,17 @@ bool File::CreateDir(const std::string &path)
PanicAlert("Error creating directory: %i", error);
return false;
#else
- if (mkdir(path.c_str(), 0644) == 0)
- return true;
+ if (mkdir(path.c_str(), 0644) == 0)
+ return true;
- int err = errno;
+ int err = errno;
- if (err == EEXIST) {
- PanicAlert("%s already exists", path.c_str());
- return true;
- }
+ if (err == EEXIST) {
+ PanicAlert("%s already exists", path.c_str());
+ return true;
+ }
- PanicAlert("Error creating directory: %s", strerror(err));
+ PanicAlert("Error creating directory: %s", strerror(err));
return false;
#endif
@@ -103,13 +124,16 @@ bool File::CreateDir(const std::string &path)
std::string GetUserDirectory() {
#ifdef _WIN32
- //TODO
- return std::string("");
+ char path[MAX_PATH];
+ if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
+ {
+ return std::string(path);
+ }
+ return std::string("");
#else
- char *dir = getenv("HOME");
- if (!dir)
- return std::string("");
-
- return dir;
+ char *dir = getenv("HOME");
+ if (!dir)
+ return std::string("");
+ return dir;
#endif
}