I have encountered a problem when i want to read & write from a text file after i build the project for iOS. Before the build everything works fine. After the build the game is not able to read the text file. In Xcode i get the following error.
Could not find file "/var/mobile/Applications/00D2CD16-80C4-4E49-8632-58F62A3A8B00/BottleRoulette.app/Data/words_english.txt".
I assume this is a temporary file made for the build. This is the code I am using.
i mport System.IO;
I also tried to code a hard path & use persistentDataPath with no success. Anyone knows how this is done properly?
Thanks in advance.
asked Nov 22 '11 at 03:33 PM
If you call Load before append the file you are looking for has not been created yet.
answered Feb 19 '12 at 11:19 AM
What is your full path to the file you want to modify? I spend several hours to solve this problem, so this is the way I've solved it: The first - use Application.persistentDataPath instead of Application.dataPath. And the second - I was trying to modify Application.persistentDataPath/Resources/file.txt and got the same error, then I put my file to the root folder Application.persistentDataPath/file.txt and write operation succeeded. Tested on Mac, Windows and iOS. Hope it helps!