From 64d43211c9c03fa860c293d05a5214ef30cb7da0 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Mon, 27 Dec 2010 00:26:52 +0000 Subject: [PATCH] Use the same code for populating user data directories one by one on OS X as on other Unices so OS X initial installs aren't so easily broken by files being created in constructors. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6661 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/CommonPaths.h | 2 ++ Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp | 7 +++-- Source/Core/DolphinWX/Src/Main.cpp | 32 +++++++++------------ 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Source/Core/Common/Src/CommonPaths.h b/Source/Core/Common/Src/CommonPaths.h index 32f476d62e..751d95a10f 100644 --- a/Source/Core/Common/Src/CommonPaths.h +++ b/Source/Core/Common/Src/CommonPaths.h @@ -75,6 +75,8 @@ #define SYSDATA_DIR "Sys" #elif defined __APPLE__ #define SYSDATA_DIR "Contents/Resources/Sys" + #define SHARED_USER_DIR File::GetBundleDirectory() + \ + DIR_SEP USERDATA_DIR DIR_SEP #else #ifdef DATA_DIR #define SYSDATA_DIR DATA_DIR "sys" diff --git a/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp b/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp index bc4077136f..ad629bfe52 100644 --- a/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp +++ b/Source/Core/DolphinWX/Src/GeckoCodeDiag.cpp @@ -198,11 +198,12 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&) // read new code case 0 : { - std::istringstream ss(line); - std::getline(ss, gcode.name, '['); // stop at [ character (begining of contributer name) + std::istringstream ssline(line); + // stop at [ character (begining of contributer name) + std::getline(ssline, gcode.name, '['); gcode.name = StripSpaces(gcode.name); // read the code creator name - std::getline(ss, gcode.creator, ']'); + std::getline(ssline, gcode.creator, ']'); read_state = 1; } break; diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 0659d3e50a..e3c2efea66 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -280,27 +280,21 @@ bool DolphinApp::OnInit() delete [] tmpChar; } } -#endif - -#ifdef __APPLE__ - const char *AppSupportDir = File::GetUserPath(D_USER_IDX); - - if (!File::Exists(AppSupportDir)) - { - // Fresh run: create Dolphin dir and copy contents of User within the bundle to App Support - File::CopyDir(std::string(File::GetBundleDirectory() + DIR_SEP USERDATA_DIR DIR_SEP).c_str(), AppSupportDir); - } - else if (!File::IsDirectory(AppSupportDir)) - PanicAlert("~/Library/Application Support/Dolphin exists, but is not a directory"); -#elif !defined _WIN32 +#else //create all necessary directories in user directory //TODO : detect the revision and upgrade where necessary - File::CopyDir(SHARED_USER_DIR CONFIG_DIR DIR_SEP, File::GetUserPath(D_CONFIG_IDX)); - File::CopyDir(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP, File::GetUserPath(D_GAMECONFIG_IDX)); - File::CopyDir(SHARED_USER_DIR MAPS_DIR DIR_SEP, File::GetUserPath(D_MAPS_IDX)); - File::CopyDir(SHARED_USER_DIR SHADERS_DIR DIR_SEP, File::GetUserPath(D_SHADERS_IDX)); - File::CopyDir(SHARED_USER_DIR WII_USER_DIR DIR_SEP, File::GetUserPath(D_WIIUSER_IDX)); - File::CopyDir(SHARED_USER_DIR OPENCL_DIR DIR_SEP, File::GetUserPath(D_OPENCL_IDX)); + File::CopyDir(std::string(SHARED_USER_DIR CONFIG_DIR DIR_SEP).c_str(), + File::GetUserPath(D_CONFIG_IDX)); + File::CopyDir(std::string(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP).c_str(), + File::GetUserPath(D_GAMECONFIG_IDX)); + File::CopyDir(std::string(SHARED_USER_DIR MAPS_DIR DIR_SEP).c_str(), + File::GetUserPath(D_MAPS_IDX)); + File::CopyDir(std::string(SHARED_USER_DIR SHADERS_DIR DIR_SEP).c_str(), + File::GetUserPath(D_SHADERS_IDX)); + File::CopyDir(std::string(SHARED_USER_DIR WII_USER_DIR DIR_SEP).c_str(), + File::GetUserPath(D_WIIUSER_IDX)); + File::CopyDir(std::string(SHARED_USER_DIR OPENCL_DIR DIR_SEP).c_str(), + File::GetUserPath(D_OPENCL_IDX)); if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));