Skip to content

Commit afdefec

Browse files
committed
provide file passed by android to open in PYTHON_OPENFILE env var
1 parent bb068b6 commit afdefec

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,21 @@ public void waitForResume() {
395395
}
396396
}
397397
}
398+
setOpenFile();
399+
}
400+
401+
/**
402+
* if the activity was called with a file parameter, put it in the
403+
* 'PYTHON_OPENFILE' env var
404+
*/
405+
public static void setOpenFile(){
406+
final android.content.Intent intent = mActivity.getIntent();
407+
if (intent != null) {
408+
final android.net.Uri data = intent.getData ();
409+
if (data != null){
410+
nativeSetEnv("PYTHON_OPENFILE", data.getEncodedPath());
411+
}
412+
}
398413
}
399414

400415
/**
@@ -437,7 +452,6 @@ public void onResume() {
437452
this.notifyAll();
438453
}
439454
}
440-
441455
wakeLock.acquire();
442456
}
443457

@@ -596,8 +610,9 @@ public void run() {
596610
return;
597611
}
598612

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

602617
nativeResize(mWidth, mHeight);
603618
nativeInitJavaCallbacks();

0 commit comments

Comments
 (0)