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 › Folder structure reading question
Page Index Toggle Pages: 1
Folder structure reading question (Read 308 times)
Folder structure reading question
Jun 10th, 2009, 1:09pm
 
So I'm creating a program to read sequential-image loops and run them. Right now, using a bit of Daniel Shiffman's listing-files hack, I've got it reading all the images out of /data and running the loop.

What I'm looking for is a way to make this more extensible; i.e., to have subdirectories of /data (or some other folder) with individual sequential loops in them that can be run simultaneously. My first idea was to place the loop reading/displaying in an object, and the name of the subdirectory passed to it, so it could read each one without having to hard-code it all.

Right now I'm using dataPath() to read the data dir, but changing the string to something like "/data/ball" or "../ball" doesn't seem to be working. Also, looking through the dataPath() docs leads me to believe that, upon compiling, the data dir structure is folded into the .jar file in such a way that it can't be read sequentially like that. Is this the case? If so, is there another way, perhaps using something other than dataPath(), to read a folder structure independent of the contents of .jar file?
Re: Folder structure reading question
Reply #1 - Jun 11th, 2009, 2:15am
 
Quote:
Right now I'm using dataPath() to read the data dir, but changing the string to something like "/data/ball" or "../ball" doesn't seem to be working.

To access files in subfolders inside the data folder then use  "ball/file.ext" Smiley
Re: Folder structure reading question
Reply #2 - Jun 11th, 2009, 6:50pm
 
Thanks, but I'm not sure I follow you. What I'm trying to do is use the the method in the listing-files hack to count the number of files in each subdirectory, so I don't have to keep manually feeding it file names. So unless "file.ext" is a java.io thing (have to check the docs), then I don't think I want that syntax. No?
Page Index Toggle Pages: 1