On unity 2019 I’m trying to write to the persistent data path on android, but it throws a DirectoryNotFound exception, here is the code I am using:
var filePath = Path.Combine(Application.persistentDataPath, fileName);
File.WriteAllBytes(filePath, fileData);
Any idea on what I am missing/doing wrong ?
nilsdr
December 11, 2019, 10:22am
2
So what is the filename? Does it define a subfolder, and if so, does that subfolder exist
it does not define a subfolder, it’s just “xxxx.json”, the error is:
12/10 23:14:46.129 22215 22279 Error Unity: DirectoryNotFoundException: Could not find a part of the path “/jar:file:/data/app/com.Epitech.Globswar-klv4qx1S_vWpPoYicgkgKA==/base.apk!/assets/StreamingAssets/file.json”.
kyrios592_unity:
it does not define a subfolder, it’s just “xxxx.json”, the error is:
12/10 23:14:46.129 22215 22279 Error Unity: DirectoryNotFoundException: Could not find a part of the path “/jar:file:/data/app/com.Epitech.Globswar-klv4qx1S_vWpPoYicgkgKA==/base.apk!/assets/StreamingAssets/file.json”.
The path you pasted is Application.streamingAssetsPath, not persistentDataPath.
Yes, I pasted the wrong one, my bad, I’m not home right now, so I can’t get it