BugFix: Android reading included files error
catshift opened this issue · 1 comments
In the ./locale folder, we have files with roots and filenames.
Like:
./locale/english/sprite.txt: ./sprite/battle_button_fight.ini
And the source code load files by this root:
GMU_LANG_PATH_BASE+LANG+"/"+GMU_LANG_PATH_STRING
which results in ./locale/english/./sprite/battle_button_fight.ini
In Windows, this error can be handled by Windows itself, but will not in Android.
A change to files like ./sprite/battle_button_fight.ini -> sprite/battle_button_fight.ini is fine, you can also change the source code to fix this.
Another to fix is in
./scripts/Lang_Custom/Lang_LoadList.gml:
function Lang_LoadList() {
Lang_ClearList();
var STR=Lang_LoadFileToString(GMU_LANG_PATH_BASE+GMU_LANG_PATH_LIST);
if(STR==""){
return false;
}
var LIST=global._gmu_lang_list;
var FILE=file_text_open_from_string(STR);
while(!file_text_eof(FILE)){
var LANG=file_text_read_string(FILE);
file_text_readln(FILE);
if(!Lang_IsExists(LANG)){
- if(directory_exists(GMU_LANG_PATH_BASE+LANG)){
+ if(true){
ds_list_add(LIST,LANG);
}
}
}
file_text_close(FILE);
return !ds_list_empty(LIST);
}
This is a strange bug that directory_exists does not run properly in Android, which might be a bug from Gamemaker itself.
You may also make a change in ./scripts/Lang_Custom/Lang_Custom.gml:
I made a change here for safety but has not tested if it is necessary.
- #macro GMU_LANG_PATH_BASE "./locale/"
+ #macro GMU_LANG_PATH_BASE working_directory+"locale/"
#macro GMU_LANG_PATH_LIST "list.txt"
#macro GMU_LANG_PATH_STRING "string.txt"
#macro GMU_LANG_PATH_SPRITE "sprite.txt"