Page 1 of 1
Finding a folder
Posted: Tue May 25, 2010 3:01 pm
by dhobbs
Hi,
I need to determine if a folder exists already. I am going to use a folder to store all my app related files and information, and I know how to create the folder if it does not exist. But, how to I tell if it is already there?
Thanks,
--Doug
Re: Finding a folder
Posted: Tue May 25, 2010 3:05 pm
by bn
Hi Doug,
try
there is
from the dictionary:
there is a {object | file filePath | folder folderPath | process procName}
regards
Bernd
Re: Finding a folder
Posted: Tue May 25, 2010 3:10 pm
by dhobbs
Perfect. That's exactly what I need. I never would have thought about looking up that.
thanks,
--Doug
Re: Finding a folder
Posted: Wed Dec 22, 2010 3:47 pm
by exheusden
Excellent, I wouldn't have thought of "there is," either.
Still, there is something else, elated to this question that I would like to know. The dictionary entry states,
The folderPath specifies the name and location of a folder you want to check. If you specify a name but not a location, Revolution looks for the folder in the defaultFolder.
But where is the defaultFolder? Yes, it can be set, but what if I want to locate something in the same folder from which the stack was started? In the dictionary entry for defaultFolder, we read,
When a Revolution application starts up, the defaultFolder initially contains whatever the working directory was at the time the application was launched. Typically this is the folder that the application resides in, however this is not always the case and shouldn't be relied on. It is best always to set the defaultFolder before using relative paths.
Can the defaultFolder be set to the same folder from which the stack was started (irrespective of where it resides)?
Re: Finding a folder
Posted: Wed Dec 22, 2010 9:04 pm
by bn
Hi Exheusden,
the whole is a bit tricky.
have a look here (in lessons)
http://lessons.runrev.com/spaces/lesson ... esides-in-
and here (also in lessons)
http://lessons.runrev.com/spaces/lesson ... nd-Windows
You can access some Livedode functions only if you first set the default folder. E.g. the files or the folders.
The thing is that depending on whether you want to save from a standalone or from the IDE things differ. But the lessons show you how.
Kind regards
Bernd
Re: Finding a folder
Posted: Thu Dec 23, 2010 11:08 am
by exheusden
Excellent. Thank you very much.