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.
IndexSuggestions & BugsSoftware,  Documentation,  Website Suggestions › loadStrings() and saveStrings()
Page Index Toggle Pages: 1
loadStrings() and saveStrings() (Read 542 times)
loadStrings() and saveStrings()
May 9th, 2006, 8:24pm
 
I find it rather inconsistent and less functional that while saveStrings() will save into the Sketch's folder, loadStrings() doesn't load from the sketch folder, only the Data folder. This functionality, in addition to adding consistency in the library, would allow users to load text files that have been changed as the program runs. This would be very useful for level editing in a game that I'm making which has an external editor. It's a bit annoying to recompile just to load a new level.

I know that there are workarounds (using non-processing Java functions, loading using PHP and getStrings("server.php?file=blah.txt") as I am doing now), but it seems to me that this wouldn't be that hard to do.

One way to implement this in addition to the current functionality would be to  add a check in the getStrings() function and if the file does not exist in the included data, it tries to load the file from the sketch/app folder. Or perhaps two separate functions: getStrings and getFileStrings()
Re: loadStrings() and saveStrings()
Reply #1 - May 9th, 2006, 9:02pm
 
that's because all the saveXxx() functions (like saveFrame) save to the sketch folder, and the data folder is wrapped up in a jar--a place that it's impossible to save things, particularly when online.

as for loading from the main folder, have you tried it? it should already work.
Page Index Toggle Pages: 1