Fixed incorrect SD card location for install paths
This commit is contained in:
@@ -8,6 +8,7 @@ import android.view.MotionEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.os.Environment;
|
||||
|
||||
import android.widget.TextView;
|
||||
import org.apache.http.client.methods.*;
|
||||
@@ -149,7 +150,7 @@ class DataDownloader extends Thread
|
||||
//Status.setText( "Connecting to " + Globals.DataDownloadUrl );
|
||||
outFilesDir = Parent.getFilesDir().getAbsolutePath();
|
||||
if( Globals.DownloadToSdcard )
|
||||
outFilesDir = "/sdcard/app-data/" + Globals.class.getPackage().getName();
|
||||
outFilesDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/app-data/" + Globals.class.getPackage().getName();
|
||||
DownloadComplete = false;
|
||||
this.start();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,6 @@ class Globals {
|
||||
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1;
|
||||
|
||||
// Phone-specific config
|
||||
// It will download app data to /sdcard/alienblaster if set to true,
|
||||
// otherwise it will download it to /data/data/de.schwardtnet.alienblaster/files
|
||||
public static boolean DownloadToSdcard = true;
|
||||
public static boolean PhoneHasTrackball = false;
|
||||
public static boolean PhoneHasArrowKeys = false;
|
||||
|
||||
@@ -17,6 +17,7 @@ import android.view.MotionEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.os.Environment;
|
||||
|
||||
import android.widget.TextView;
|
||||
import java.lang.Thread;
|
||||
@@ -211,7 +212,10 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
|
||||
// Tweak video thread priority, if user selected big audio buffer
|
||||
if(Globals.AudioBufferConfig >= 2)
|
||||
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
|
||||
nativeInit(Globals.CommandLine); // Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
|
||||
nativeInit( Globals.DownloadToSdcard ?
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath() + "/app-data/" + Globals.class.getPackage().getName() :
|
||||
context.getFilesDir().getAbsolutePath(),
|
||||
Globals.CommandLine); // Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
|
||||
System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
|
||||
}
|
||||
|
||||
@@ -264,7 +268,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
|
||||
};
|
||||
|
||||
private native void nativeInitJavaCallbacks();
|
||||
private native void nativeInit(String CommandLine);
|
||||
private native void nativeInit(String CurrentPath, String CommandLine);
|
||||
private native void nativeResize(int w, int h, int keepAspectRatio);
|
||||
private native void nativeDone();
|
||||
private native void nativeGlContextLost();
|
||||
|
||||
Submodule project/jni/application/commandergenius updated: 3add96a0ee...45476807e1
@@ -1 +1 @@
|
||||
fheroes2
|
||||
commandergenius
|
||||
@@ -28,7 +28,7 @@
|
||||
static int isSdcardUsed = 0;
|
||||
|
||||
extern C_LINKAGE void
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring cmdline )
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring jcurdir, jstring cmdline )
|
||||
{
|
||||
int i = 0;
|
||||
char curdir[PATH_MAX] = "";
|
||||
@@ -49,6 +49,12 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
|
||||
strcat(curdir, SDL_CURDIR_PATH);
|
||||
strcat(curdir, "/files");
|
||||
}
|
||||
|
||||
jstr = (*env)->GetStringUTFChars(env, jcurdir, NULL);
|
||||
if (jstr != NULL && strlen(jstr) > 0)
|
||||
strcpy(curdir, jstr);
|
||||
(*env)->ReleaseStringUTFChars(env, jcurdir, jstr);
|
||||
|
||||
if( realpath(curdir, realcurdir) == NULL )
|
||||
strcpy(realcurdir, curdir);
|
||||
chdir(realcurdir);
|
||||
@@ -94,9 +100,6 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz, jstring
|
||||
for( i = 0; i < argc; i++ )
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "param %d = \"%s\"", i, argv[i]);
|
||||
|
||||
//freopen("/dev/null", "w", stdout); // It crashes on Smartq V7 anyway, inside these lines
|
||||
//freopen("/dev/null", "w", stderr);
|
||||
|
||||
main( argc, argv );
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user