We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi I am working on a bluetooth remote app that saves controller layouts as .txt files. Saving and then loading the files already works. But only in this order. If I try to load a save file that does not exist, the app crashes. This is understandable. But the real problem is:
The file.exists()-function returns false at all times, even if the file exists.
File f = new File("settings.txt"); if(!f.getAbsoluteFile().exists()) println("file not found"); else println("found");
Putting the file in the sketch data folder before compiling works but leads to the file being not rewriteable. This means the app somehow can't change the strings in the txt.
Writing a setup function to save the files at the first startup won't work, too, because the sketch is unable to check if it was executed before.
This makes it impossible to save any kind of progress whatsoever. Thanks in advance for your help!
Answers
Just found the solution here: http://processing.org/discourse/beta/num_1196028323.html
All you need is add "dataPath()" to the file name. This makes sure "file.exists()" can find the file.