I'm (still) porting an A5 game I wrote for RaspberryPi and Windows to Android. My current difficulty is creating/writing files. Hi score tables, saved config, that sort of thing.
As per this thread ( https://www.allegro.cc/forums/thread/617058 ) I learned that I need to call al_android_set_apk_file_interface() in order to load any assets, but according to the manual this gives read-only access.
I tried the following, hoping to write a file somewhere:
(Incidentally, I haven't used al_android_set_apk_file_interface() here, so that's not causing problems)
If I step through the code, I see:
pathstr = data/user/0/com.tootiredgames.gravstorm/files (output from get_standard_path)
pathptr = /data/data/com.tootiredgames.gravstorm/files (output from get_current_directory)
If I look at the filesystem, either with an android file manager, or under windows when connected by USB, I see a path that looks more like:
This PC\MotoE2(4G-LTE)\Internal storage\Android\data\com.tootiredgames.gravstorm\files
al_fopen returns a pointer (i.e. not NULL) and both al_fputs() and al_fclose() return success.
So, can anyone help with any of these questions:
What should I be doing differently to write a file, and where can I find it?
Failing answers to that, does anyone know:
- Why do I end up with different values for pathstr and pathptr?
- Why do neither of them match what I see with a file browser?
- Where, if anywhere, has my file been written?