-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Made getRealExternalStorageDirectory static and public and changed the dataPath location to use Android standards #1492
Made getRealExternalStorageDirectory static and public and changed the dataPath location to use Android standards #1492
Conversation
This way you can use this method in your application as well if needed. 2. Changed the dataPath location to the proper storage location. According to the official developer guide, files written to the external storage should be placed in: /Android/data/<package_name> More information can be found in the Android guide: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal section Accessing files on external storage This will also help to keep the SDcard clean and prevents assets from being indexed as /Android/data usually contains a .nomedia file.
a couple of things, can you make the variable private again? the method is ok as public static but i think it's better to keep the variable as private in case we need to change it in the future with only the method as public it's easier to mantain compatibility with older projects also, even if this is the right directory to put application data, it's going to break old applications storing configuration in the current location. what if we added some code that checks if the old location exists and moves the directory to /sdcard/Android? we can remove that code in a couple of versions |
@arturoc Sounds good, I'll make the array private again and will start working on some code that detects whether the old directory exists and needs to be moved to the new location. |
some of this was addressed by this commit. I'd +1 the move to /Android/data/<package_name>/files/ . Let me know if I can help with that. |
yes we should move to Android/data/package_name, the only thing missing is some mechanism to move the directory for old projects if it exists at the root level, i think it should be done in the c++ side if you want to take a look |
Added a check to see if the old data location exists. If it does, data will be moved to the new storage location.
@arturoc & @thiagohersan : Sorry for the delay, I've implemented both suggested fixes in the latest commit. |
@falcon4ever watch out, currently your PR can't be merged because of a merge conflict. probably because you made some changes which touched code someone else changed in the meantime. in your local repo, fetch current develop, merge it into your PR branch, and fix the appearing merge conflict, then push your PR branch again. |
@bilderbuchi Ok I'll try to merge it with the latest develop in a bit. |
@bilderbuchi Ok, I sorted out the conflict and I think it should be merged alright now. |
looks great, thanks! |
…efix2 Made getRealExternalStorageDirectory static and public and changed the dataPath location to use Android standards
@arturoc This a small update to my previous patch
This way you can use this method in your application as well if needed.
According to the official developer guide, files written to the external storage should be placed in: /Android/data/<package_name>
More information can be found in the Android guide: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal section Accessing files on external storage
This will also help to keep the SDcard clean and prevents assets from being indexed as /Android/data usually contains a .nomedia file.