From 05e9ae0f6f486e8436ff201be40c657948e7623b Mon Sep 17 00:00:00 2001 From: bushing Date: Mon, 8 Dec 2008 09:52:30 +0000 Subject: [PATCH] chdir to ~/Library/Application Support/Dolphin on OS X, to place our user root there git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1443 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Main.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 0de4547f48..59d5cce98f 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -23,6 +23,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + #include "Globals.h" // Core #include "Host.h" @@ -134,7 +138,26 @@ bool DolphinApp::OnInit() }; #if defined(__APPLE__) - // HACK: Get rid of bogous osx param + // check to see if ~/Library/Application Support/Dolphin exists; if not, create it + char AppSupportDir[MAXPATHLEN]; + snprintf(AppSupportDir, sizeof(AppSupportDir), "%s/Library/Application Support", getenv("HOME")); + if (!File::Exists(AppSupportDir) || !File::IsDirectory(AppSupportDir)) + PanicAlert("Could not open ~/Library/Application Support"); + + strlcat(AppSupportDir, "/Dolphin", sizeof(AppSupportDir)); + + if (!File::Exists(AppSupportDir)) + File::CreateDir(AppSupportDir); + + if (!File::IsDirectory(AppSupportDir)) + PanicAlert("~/Library/Application Support/Dolphin exists, but is not a directory"); + + chdir(AppSupportDir); + + if (!File::Exists("User")) File::CreateDir("User"); + if (!File::Exists("User/GC")) File::CreateDir("User/GC"); + + // HACK: Get rid of bogus osx param if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) { delete argv[argc-1]; argv[argc-1] = NULL;