-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complied App can't access any of its files #104
Comments
I've written some code that allows the parsing and then loading of images in subfolders that works for both App and Preview:
|
Looks great! Until which target Api have you tested? |
Edit: I've updated the code and replaced Path with String, it works on all the phones I have access to now. I've tried it on phones with API's from 23-29. If you combine my file path generating code with the solution found here #88, then you only need the app mode code for loading the images |
In preview mode, the data folder gets copied into the app's internal storage. In app mode, the data folder lives in assets inside the APK. I talk about this in the technical quirks section of the preview mode wiki page. I don't fully remember the specifics enough to understand the nuanced behavior you're seeing here, but it definitely sounds like it's worth it for me to revisit the way the data folder is handled. For reference the relevant code is in |
I've been working on a game for a few months and have just started looking into testing it on other phones. When running in App mode or exporting a signed .apk, I can't access any of the files in the application directory using commands like "dataPath("")" and "context.getFilesDir()", the application doesn't see them and says the directory is empty. I've found that I can get around this by using AssetManager.list("subfolder"), but this doesn't work in preview mode, it returns an empty list. I'm not sure if I'm missing something, but it seems like some file functionality works in one mode and some in the other.
Using functions like "loadImage("filename.type")" works fine in both modes, but my game needs to parse all the image files in a couple of sub-directories and create objects for each of them, which can't be done with specific calls to loadImage().
I've done a lot of googling trying to find a solution. Am I doing something wrong, or is this a bug?
The text was updated successfully, but these errors were encountered: