- Home /
Problem with persistentDataPath on Android
Having a devil of a time with saving files on Android. I Debug.Log where it thinks it will save:
Debug.Log (“Saving to:”+Application.persistentDataPath+”/myfile.png”);
Application.CaptureScreenshot (Application.persistentDataPath+"/myfile.png");
and it fail to save it, my log says:
Saving to:/data/data/com.mycomp.myapp/files/myfile.png
then
Failed to open file at path: /data/data/com.mycomp.myapp/data/data/com.mycomp.myapp/files/myfile.png
which is REALLY messed up. Clearly I should remove the persistentpath from the CaptureScreenshot call, but /data/data? Where's that?
I have set project player settings to use external file.
This happens on a Droid4 (Android 2.3.6). On Xoom (Android 4.0.4) it saves to mnt/sdcard/com.mycomp.myapp/files/myfile.png just fine.
What's going on?
Answer by raimon.massanet · Nov 19, 2014 at 12:41 PM
The problem is that you are appending the file name to the persistent data path. This is already done by Application.CaptureScreenshot
on mobile platforms, as stated in the documentation.
I want to run both on mobile and desktop, is there a solution for that?
Your answer
Follow this Question
Related Questions
Opening data file from asset folder 2 Answers
Sharing photos and other files on android? 1 Answer
How to get Application.PersistentDataPath inside a Java Android Plugin 1 Answer
Print image via Android App 0 Answers
Saved Android app files get automatically recovered from nowhere even after re-installing app. 3 Answers