OSX fix Dolphin not actually using the Application Support path.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5445 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2010-05-12 04:26:32 +00:00
parent bbc9e8cb71
commit e7099251ce
5 changed files with 31 additions and 71 deletions

View File

@ -57,7 +57,10 @@
#define USERDATA_DIR "User"
#define DOLPHIN_DATA_DIR "Dolphin"
#elif defined __APPLE__
#define USERDATA_DIR "User"
// On OS X, USERDATA_DIR exists within the .app, but *always* reference
// the copy in Application Support instead! (Copied on first run)
// You can use the File::GetUserPath() util for this
#define USERDATA_DIR "Contents/User"
#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin"
#elif defined __linux__
#define USERDATA_DIR "user"

View File

@ -488,10 +488,10 @@ bool DeleteDirRecursively(const char *directory)
return true;
}
#ifdef __linux__
//Create directory and copy contents (does not overwrite existing files)
void CopyDir(const char *source_path, const char *dest_path)
{
#ifndef _WIN32
if (!strcmp(source_path, dest_path)) return;
if (!File::Exists(source_path)) return;
if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);
@ -525,8 +525,8 @@ void CopyDir(const char *source_path, const char *dest_path)
else if (!File::Exists(dest)) File::Copy(source, dest);
}
closedir(dirp);
}
#endif
}
// Returns the current directory
std::string GetCurrentDir()
@ -553,7 +553,6 @@ bool SetCurrentDir(const char *_rDirectory)
#if defined(__APPLE__)
std::string GetBundleDirectory()
{
// Plugin path will be Dolphin.app/Contents/PlugIns
CFURLRef BundleRef;
char AppBundlePath[MAXPATHLEN];
// Get the main bundle for the app
@ -574,7 +573,6 @@ std::string GetBundleDirectory()
}
#endif
// Returns the path to where the plugins are
std::string GetPluginsDirectory()
{
std::string pluginsDir;
@ -596,7 +594,6 @@ std::string GetPluginsDirectory()
return pluginsDir;
}
// Returns the path to where the sys file are
std::string GetSysDirectory()
{
std::string sysDir;
@ -657,18 +654,13 @@ const char *GetUserPath(int DirIDX)
#ifdef _WIN32
// Keep the directory setup the way it was on windows
snprintf(UserDir, sizeof(UserDir), ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP);
//char homedir[MAX_PATH];
//if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, path)))
// return NULL;
#else
#elif defined (__linux__)
if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
snprintf(UserDir, sizeof(UserDir), ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP);
else
{
char *homedir = getenv("HOME");
if (homedir)
snprintf(UserDir, sizeof(UserDir), "%s" DIR_SEP DOLPHIN_DATA_DIR DIR_SEP, homedir);
}
snprintf(UserDir, sizeof(UserDir), "%s" DIR_SEP DOLPHIN_DATA_DIR DIR_SEP, getenv("HOME"));
#else
snprintf(UserDir, sizeof(UserDir), "%s" DIR_SEP DOLPHIN_DATA_DIR DIR_SEP, getenv("HOME"));
#endif
INFO_LOG(COMMON, "GetUserPath: Setting user directory to %s:", UserDir);

View File

@ -111,7 +111,7 @@ bool DeleteDirRecursively(const char *directory);
// Returns the current directory
std::string GetCurrentDir();
//Create directory and copy contents (does not overwrite existing files)
// Create directory and copy contents (does not overwrite existing files)
void CopyDir(const char *source_path, const char *dest_path);
// Set the current directory to given directory

View File

@ -18,30 +18,30 @@
#include "../Memmap.h"
#include "../EXI_Device.h"
#include "../EXI_DeviceEthernet.h"
bool CEXIETHERNET::deactivate()
{
bool CEXIETHERNET::deactivate() {
return true;
}
bool CEXIETHERNET::isActivated()
{
bool CEXIETHERNET::isActivated() {
return false;
}
bool CEXIETHERNET::activate() {
return false;
return false;
}
bool CEXIETHERNET::CheckRecieved()
{
bool CEXIETHERNET::CheckRecieved() {
return false;
}
bool CEXIETHERNET::resume() {
return false;
}
bool CEXIETHERNET::startRecv() {
return false;
}
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size)
{
bool CEXIETHERNET::sendPacket(u8 *etherpckt, int size) {
return false;
}
bool CEXIETHERNET::handleRecvdPacket()
{
bool CEXIETHERNET::handleRecvdPacket() {
return false;
}
bool CEXIETHERNET::cbwriteDescriptor(u32 size) {
return false;
}

View File

@ -302,59 +302,24 @@ bool DolphinApp::OnInit()
}
#endif
#ifdef __APPLE__
// 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));
#ifdef __APPLE__
const char *AppSupportDir = File::GetUserPath(D_USER_IDX);
if (!File::Exists(AppSupportDir))
File::CreateDir(AppSupportDir);
if (!File::IsDirectory(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");
chdir(AppSupportDir);
//create all necessary dir in user directory
if (!File::Exists(File::GetUserPath(D_CONFIG_IDX)))
File::CreateDir(File::GetUserPath(D_CONFIG_IDX));
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX)))
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
if (!File::Exists(File::GetUserPath(D_WIISYSCONF_IDX)))
File::CreateFullPath(File::GetUserPath(D_WIISYSCONF_IDX));
if (!File::Exists(File::GetUserPath(D_CACHE_IDX)))
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX)))
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX)))
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX)))
File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX)))
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX)))
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX)))
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
//copy user wii shared2 SYSCONF if not exist
if (!File::Exists(File::GetUserPath(F_WIISYSCONF_IDX)))
File::Copy((File::GetBundleDirectory() + DIR_SEP + "Contents" + DIR_SEP + USERDATA_DIR + DIR_SEP + WII_SYSCONF_DIR + DIR_SEP + WII_SYSCONF).c_str(),
File::GetUserPath(F_WIISYSCONF_IDX));
//TODO : if not exist copy game config dir in user dir and detect the revision to upgrade if necessary
//TODO : if not exist copy maps dir in user dir and detect revision to upgrade if necessary
#if !wxCHECK_VERSION(2, 9, 0)
// HACK: Get rid of bogus osx param
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
delete argv[argc-1];
argv[argc-1] = NULL;
argc--;
}
}
#endif
#endif