We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › loading file path with app export
Page Index Toggle Pages: 1
loading file path with app export (Read 727 times)
loading file path with app export
Oct 30th, 2006, 11:57am
 
I'm exporting an app with a preference file that I load data from everytime the program starts.  I also save to the same file afterwards.  The file is located in the code's subfolder of data/preference.txt  and in the code, i call loadStrings("data/preference.txt") to load the data.  and save is the same.  ok, but when I export the app as an application, I save to a data folder with the files alright, but it's loading the text file from another source.  i'm assuming it's packaged in with the content (i'm using a mac btw) but is there a way to undo that? like ../ syntax or somehow load a file that's in the directory the application is in and not within itself?

-j
Re: loading file path with app export
Reply #1 - Oct 30th, 2006, 2:00pm
 
I think there is String dataPath(String file) and String sketchPath(String file); which poin tto the data dir, and the sketch dir respectively, so sketchPath("preference.txt"); woudl return a string that you can pass to the file functions.
Re: loading file path with app export
Reply #2 - Oct 30th, 2006, 3:04pm
 
some additional info under the.. 5th? item in this section:
http://processing.org/reference/troubleshooting/index.html#issues

depending on how much effort you want to put in, Java has a "preferences" API that you could also use.
Page Index Toggle Pages: 1