Hello guys. My question got deleted for some reason, I don’t understand why. I’ve been searching all over and haven’t been able to find a fix to this problem.
I created a text file that I want to save. However, on iOS it keeps giving me a DirectoryNotFoundException.
First, according to the stuff I’ve read online and based on this answer:
I made a variable set up like this:
FileLocation=Application.dataPath.Replace ("MyApp.app/Data", "Documents");
Afterwards, I try to create my file like this:
FileInfo t = new FileInfo(FileLocation+"/"+ FileName);
According to the Debug.Logs I’ve put, the location where I’m trying to save my file is this:
/private/var/mobile/Containers/Bundle/Application/7CEB4042-4143-4E25-8E49-8D7B92FD28E6/Documents/SaveData.nom
However, I get the following exception whenever I try to save/create that file:
DirectoryNotFoundException: Could not find a part of the path "/private/var/mobile/Containers/Bundle/Application/9B8A0040-90B5-4BA1-A568-9F999FF25122/Documents/SaveData.nom". at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in :0
Why is that? According to what I’ve read, the “Documents” folder is where I can save things. Has this changed in the most recent version of XCode or something?
According to the question I linked to above, this should work! But for some reason it’s not.
Please help me out. I have been searching for answers but haven’t found anything at all that can fix this.