From 5a69fca0be4c00267a0e8c4fbbb4b6bdafe7213d Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 7 Sep 2008 10:29:46 +0000 Subject: 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 --- Source/Core/Common/Src/FileUtil.cpp | 54 ++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 15 deletions(-) (limited to 'Source/Core/Common/Src/FileUtil.cpp') 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 // for SHGetFolderPath #include +#include // for GetSaveFileName #else + #include #include #include @@ -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 } -- cgit v1.2.3