Android: Don't extract Sys if it already is extracted
This commit is contained in:
parent
b3b7aef09a
commit
3262314435
|
@ -283,6 +283,8 @@ public final class NativeLibrary
|
|||
*/
|
||||
public static native String GetVersionString();
|
||||
|
||||
public static native String GetGitRevision();
|
||||
|
||||
/**
|
||||
* Saves a screen capture of the game
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,8 @@ package org.dolphinemu.dolphinemu.services;
|
|||
import android.app.IntentService;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
|
@ -74,12 +76,20 @@ public final class DirectoryInitializationService extends IntentService
|
|||
{
|
||||
File sysDirectory = new File(getFilesDir(), "Sys");
|
||||
|
||||
// Delete the existing extracted Sys directory in case it's from a different version of Dolphin.
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String revision = NativeLibrary.GetGitRevision();
|
||||
if (!preferences.getString("sysDirectoryVersion", "").equals(revision))
|
||||
{
|
||||
// There is no extracted Sys directory, or there is a Sys directory from another
|
||||
// version of Dolphin that might contain outdated files. Let's (re-)extract Sys.
|
||||
deleteDirectoryRecursively(sysDirectory);
|
||||
|
||||
// Extract the Sys directory to app-local internal storage.
|
||||
copyAssetFolder("Sys", sysDirectory, true);
|
||||
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putString("sysDirectoryVersion", revision);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
// Let the native code know where the Sys directory is.
|
||||
SetSysDirectory(sysDirectory.getPath());
|
||||
}
|
||||
|
|
|
@ -432,6 +432,8 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(
|
|||
jstring jFilename);
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env, jobject obj);
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGitRevision(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv* env,
|
||||
|
@ -589,6 +591,12 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersio
|
|||
return env->NewStringUTF(Common::scm_rev_str.c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGitRevision(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
return env->NewStringUTF(Common::scm_rev_git_str.c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue