OK, this is a longer post for a problem that buggs me right now. I try to explain in detail, and I hope you gurus have the patience to read
I have this game which works perfectly on Android and on Windows. I have an archive (a directory structure) "alt" containing alternate images for character "xyz" (i.e. alternate images are in alt/xyz/images and the original ones that are in game/images). Let's this archive call a mod.
The mod works because in an early init state, I enhance config.searchpath like this:
["<game>/alt/xyz","<game>/game","<game>/common"]
where <game>/ is the path to the game's installation directory. So whenever an alternate image is found in <game>/alt/xyz/images it is loaded instead of what would be found in <game>/game/images later during automatic image loading in _scan_images_directory. As I said, this works well in Android and in Windows.
What does not work is when I try to load an image out of the mod's archive like this:
Code: Select all
screen mod_sample(path):
python:
if renpy.android and ("ANDROID_PUBLIC" in os.environ):
sample = os.path.join(os.environ["ANDROID_PUBLIC"], "alt")
else:
sample = config.basedir.replace('\\', '/') + '/alt'
sample += '/' + path
if os.path.isfile(sample): # Does not seem to work on Android for some reason...
add Image(sample) at center
File "renpy/common/000statements.rpy", line 531, in execute_call_screen
IOError: Couldn't find file 'storage/emulated/150/Android/data/<game>/alt/xyz/sample.png'.
As written before, the existence check before the image is attempted to load is successful. The path to the <game> directory is what the coding before that constructs from the environment variable, and the appended part to the image file is what is passed as argument to the screen.
What I noticed is that the error message is lacking the leading slash, i.e. 'storage/emulated...' instead of '/storage/emulated' which is the complete path to the image. I cannot work with the config.basedir variable because mods on Android have to be placed in the public storage.
Does anybody have a clue why displaying the image like that does not work on Android, but everything else (the modded app with the images loaded via _scan_images_directory) works?