Finding a folder

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dhobbs
Posts: 24
Joined: Tue Dec 15, 2009 6:25 pm

Finding a folder

Post by dhobbs » Tue May 25, 2010 3:01 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Finding a folder

Post by bn » Tue May 25, 2010 3:05 pm

Hi Doug,
try
there is
from the dictionary:
there is a {object | file filePath | folder folderPath | process procName}
regards
Bernd

dhobbs
Posts: 24
Joined: Tue Dec 15, 2009 6:25 pm

Re: Finding a folder

Post by dhobbs » Tue May 25, 2010 3:10 pm

Perfect. That's exactly what I need. I never would have thought about looking up that.

thanks,

--Doug

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Finding a folder

Post by exheusden » Wed Dec 22, 2010 3:47 pm

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)?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Finding a folder

Post by bn » Wed Dec 22, 2010 9:04 pm

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

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Finding a folder

Post by exheusden » Thu Dec 23, 2010 11:08 am

Excellent. Thank you very much.

Post Reply