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
This commit is contained in:
bushing 2008-12-08 09:52:30 +00:00
parent 49cfded60b
commit 05e9ae0f6f
1 changed files with 24 additions and 1 deletions

View File

@ -23,6 +23,10 @@
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
#ifdef __APPLE__
#include <sys/param.h>
#endif
#include "Globals.h" // Core #include "Globals.h" // Core
#include "Host.h" #include "Host.h"
@ -134,7 +138,26 @@ bool DolphinApp::OnInit()
}; };
#if defined(__APPLE__) #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_"))) { if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
delete argv[argc-1]; delete argv[argc-1];
argv[argc-1] = NULL; argv[argc-1] = NULL;