Skip to content

Commit 6a5c030

Browse files
committed
fix openfile when launcher is built
1 parent 301d2a5 commit 6a5c030

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/src/org/renpy/android/SDLSurfaceView.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ public void waitForResume() {
405405
public static void setOpenFile(){
406406
final android.content.Intent intent = mActivity.getIntent();
407407
if (intent != null) {
408-
final android.net.Uri data = intent.getData ();
409-
if (data != null){
408+
final android.net.Uri data = intent.getData();
409+
if (data != null && data.getEncodedPath() != null){
410410
nativeSetEnv("PYTHON_OPENFILE", data.getEncodedPath());
411411
}
412412
}
@@ -610,9 +610,8 @@ public void run() {
610610
return;
611611
}
612612

613-
Log.w(TAG, "Done");
614-
waitForStart();
615-
setOpenFile();
613+
Log.w(TAG, "Done");
614+
waitForStart();
616615

617616
nativeResize(mWidth, mHeight);
618617
nativeInitJavaCallbacks();
@@ -621,6 +620,18 @@ public void run() {
621620
nativeSetEnv("PYTHONOPTIMIZE", "2");
622621
nativeSetEnv("PYTHONHOME", mFilesDirectory);
623622
nativeSetEnv("PYTHONPATH", mArgument + ":" + mFilesDirectory + "/lib");
623+
624+
// XXX Using SetOpenFile make a crash in nativeSetEnv. I don't
625+
// understand why, maybe because the method is static or something.
626+
// Anyway, if you remove that part of the code, ensure the Laucher
627+
// (ProjectChooser) is still working.
628+
final android.content.Intent intent = mActivity.getIntent();
629+
if (intent != null) {
630+
final android.net.Uri data = intent.getData();
631+
if (data != null && data.getEncodedPath() != null)
632+
nativeSetEnv("PYTHON_OPENFILE", data.getEncodedPath());
633+
}
634+
624635
nativeSetMultitouchUsed();
625636
nativeInit();
626637

0 commit comments

Comments
 (0)