Checking if directory exists

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Checking if directory exists

Post by warrenk » Fri Sep 26, 2008 2:52 am

What is the best way to check if a directory exists?

I have been using...

set the defaultfolder to tFolderToSearch
if the result is "can't open directory" then....

Not sure if this is correct?

Warren

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Fri Sep 26, 2008 3:25 am

Warren, you're going to love this one: Rev has a "there is" operator, e.g.:

Code: Select all

if there is a folder tFolderToSearch then
Nice, eh?

Rev also supports "there is not":

Code: Select all

if there is not a folder tFolderToSearch then
You can use these with files, folders, and object descriptors.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Post by warrenk » Fri Sep 26, 2008 4:33 am

Richard,

Thanks! This looks a lot better then the method I was using.

Appreciate the help!
Warren

Post Reply