@Joshua Quick
Moai SDK replaces standard stdio function (like fread, fwrite, fseek) with their modified functions which can read zip (see zipfs from Moai SDK). Don’t you want to use similar solution for this problem? [import]uid: 9058 topic_id: 15566 reply_id: 74678[/import]
Andriy,
Yes we do want to do that, but it would be a lot of work and involve modifying the Lua library to override its default io functions (not written by Ansca) and other 3rd party libraries that we are using. We have higher priorities at the moment, such as in-app purchases on Android. That said, it is on our wish-list. [import]uid: 32256 topic_id: 15566 reply_id: 74731[/import]
Hi Joshua,
I just couldn’t read my files in the system.ResourceDirectory on Android.
After lots of hours and tries using “adb logcat” I found the problem:
My files were named
language.settings
english.settings
etc.
because I’m using rosetta.lua to localize my apps.
But these endings are not allowed, even if
*.settings
is missing in your list!
After I (as one last try) renamed the files to
language.txt
etc.
it worked!
So please update your list,
best,
Andreas
[import]uid: 107675 topic_id: 15566 reply_id: 109462[/import]
Hmm… I don’t see a “*.settings” file extension in our Android code. Are you sure Windows Explorer or Mac’s Finder window was not hiding the file extension from you? Perhaps the file was really named “language.settings.txt” and you didn’t know it? Just a guess, but I’ve seen that happen to people before. [import]uid: 32256 topic_id: 15566 reply_id: 109540[/import]
Hi Joshua,
nice try. 
But the name was really “language.settings”, otherwise it would not load - having “language.settings” in the code and “language.settings.txt” as a filename would just not work.
This is the code:
[lua]local loadFileContents = function(file)
local path = system.pathForFile( file, system.ResourceDirectory )
if path then
local file = io.open( path, “r” )
if file then – nil if no file found
local contents = file:read( “*a” )
io.close( file )
return contents
else
return nil
end
else
return nil
end
end
local contents = loadFileContents(“language.txt”)[/lua]
When I used “language.settings” in the code and as a filename, it worked on iOS, but not on Android.
As soon as I changed the filename and the code to “language.txt”, it worked on Android, too.
I did not change anything else.
So I guess it has something to do with the automatic decompressing of some file types I can read from the zipped APK.
Maybe “.settings” is in some way reserved by the Android OS and this causes the conflict?
Best,
Andreas
[import]uid: 107675 topic_id: 15566 reply_id: 109688[/import]