| View previous topic :: View next topic |
| Author |
Message |
papy newbie
Joined: 16 May 2008 Posts: 5
|
Posted: Sun May 25, 2008 3:48 am Post subject: Check Directory existence. |
|
|
I'm searching how to test if directory exists or not. In the documentation of existFile it says that :
| Quote: | | This function doesn't work to check the existence of a directory; use exploreDirectory() instead. |
so under a Linux based operating system i try the following code :
| Code: | local directory;
if !exploreDirectory(directory, "./foobar", false)
error("unable to find the directory.");
traceLine("if found the directory."); |
But it doesn't seems to work :/, can someone help me? |
|
| Back to top |
|
 |
Filth newbie
Joined: 09 May 2008 Posts: 1
|
Posted: Tue May 27, 2008 4:43 pm Post subject: |
|
|
did you try to use a non-relative path, a real one instead ? Did you try with a '/' at the end of the path ?
Try this :
| Code: |
local directory;
if !exploreDirectory(directory, "/home/papy/foobar/", false)
error("unable to find the directory.");
traceLine("if found the directory."); |
If it doesn't work, try the fileMode() function ( [url]http://codeworker.free.fr/manual_.html#fileMode()[/url] ), Perhaps this one works for directory :
| Code: |
local sPermission = fileMode("/usr/home/papy/foobar/");
if startString(sPermission, "-") error("error code = " + sPermission);
traceLine("Directory permission (so it exists) : " + sPermission); |
|
|
| Back to top |
|
 |
clemaire newbie

Joined: 09 May 2008 Posts: 13
|
Posted: Thu Jul 17, 2008 12:31 am Post subject: |
|
|
| New function "existDirectory(...)" implemented. Available in version 4.5, expected very soon! |
|
| Back to top |
|
 |
clemaire newbie

Joined: 09 May 2008 Posts: 13
|
Posted: Sun Jul 20, 2008 11:25 pm Post subject: |
|
|
| Version 4.5 available with new function existDirectory(). |
|
| Back to top |
|
 |
papy newbie
Joined: 16 May 2008 Posts: 5
|
Posted: Tue Jul 29, 2008 3:58 am Post subject: |
|
|
| Thanks it will be really helpful |
|
| Back to top |
|
 |
|