codeworker Forum Index codeworker
A universal parsing tool & a source code generator
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check Directory existence.

 
Post new topic   Reply to topic    codeworker Forum Index -> Beginner's Level Questions
View previous topic :: View next topic  
Author Message
papy
newbie


Joined: 16 May 2008
Posts: 5

PostPosted: Sun May 25, 2008 3:48 am    Post subject: Check Directory existence. Reply with quote

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
View user's profile Send private message
Filth
newbie


Joined: 09 May 2008
Posts: 1

PostPosted: Tue May 27, 2008 4:43 pm    Post subject: Reply with quote

did you try to use a non-relative path, a real one instead ? Did you try with a '/' at the end of the path ? Wink

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
View user's profile Send private message
clemaire
newbie


Joined: 09 May 2008
Posts: 13

PostPosted: Thu Jul 17, 2008 12:31 am    Post subject: Reply with quote

New function "existDirectory(...)" implemented. Available in version 4.5, expected very soon!
Back to top
View user's profile Send private message Visit poster's website
clemaire
newbie


Joined: 09 May 2008
Posts: 13

PostPosted: Sun Jul 20, 2008 11:25 pm    Post subject: Reply with quote

Version 4.5 available with new function existDirectory().
Back to top
View user's profile Send private message Visit poster's website
papy
newbie


Joined: 16 May 2008
Posts: 5

PostPosted: Tue Jul 29, 2008 3:58 am    Post subject: Reply with quote

Thanks it will be really helpful
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    codeworker Forum Index -> Beginner's Level Questions All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group