Merge pull request #2129 from Sonicadvance1/shuffle_user_dir

Move user directory detection location to UICommon.
This commit is contained in:
skidau
2015-02-27 14:07:06 +11:00
8 changed files with 99 additions and 68 deletions

View File

@ -229,12 +229,7 @@ bool DolphinApp::OnInit()
selectAudioEmulation = parser.Found("audio_emulation", &audioEmulationName);
selectPerfDir = parser.Found("perf_dir", &perfDir);
playMovie = parser.Found("movie", &movieFile);
if (parser.Found("user", &userPath))
{
File::CreateFullPath(WxStrToStr(userPath) + DIR_SEP);
File::GetUserPath(D_USER_IDX, userPath.ToStdString() + DIR_SEP);
}
parser.Found("user", &userPath);
#endif // wxUSE_CMDLINE_PARSER
// Register message box and translation handlers
@ -249,6 +244,7 @@ bool DolphinApp::OnInit()
wxHandleFatalExceptions(true);
#endif
UICommon::SetUserDirectory(userPath.ToStdString());
UICommon::CreateDirectories();
UICommon::Init();
@ -421,7 +417,6 @@ void DolphinApp::OnFatalException()
WiimoteReal::Shutdown();
}
// ------------
// Talk to GUI

View File

@ -49,6 +49,7 @@
ANativeWindow* surf;
std::string g_filename;
std::string g_set_userpath = "";
#define DOLPHIN_TAG "Dolphinemu"
@ -231,6 +232,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv *env, jobject obj, jint slot);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv *env, jobject obj, jint slot);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv *env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(JNIEnv *env, jobject obj, jstring jDirectory);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv *env, jobject obj)
@ -361,6 +363,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFo
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(JNIEnv *env, jobject obj, jstring jDirectory)
{
std::string directory = GetJString(env, jDirectory);
g_set_userpath = directory;
UICommon::SetUserDirectory(directory);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf)
{
surf = ANativeWindow_fromSurface(env, _surf);
@ -371,6 +380,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
RegisterMsgAlertHandler(&MsgAlert);
UICommon::SetUserDirectory(g_set_userpath);
UICommon::Init();
// No use running the loop when booting fails

View File

@ -324,6 +324,7 @@ int main(int argc, char* argv[])
return 1;
}
UICommon::SetUserDirectory(""); // Auto-detect user folder
UICommon::Init();
platform->Init();