PDA

View Full Version : does lscript support relative paths



dsdsdsdsd
08-05-2009, 01:37 AM
hello;

I have an lscript that uses matchdirs(); I am on a winxp;

currently I can only make it work using:
matchdirs ( "C:\\a_dir\\sub_dir\\" , "*" ) ;

I would rather use:
matchdirs ( "..\\sub_dir\\" , "*" ) ;

is there some syntax that lscript will permit for relative paths?

thanks;

Lightwolf
08-05-2009, 02:32 AM
I would rather use:
matchdirs ( "..\\sub_dir\\" , "*" ) ;

is there some syntax that lscript will permit for relative paths?

thanks;
Have you tried:

matchdirs ( "sub_dir\\" , "*" ) ;

That should work on a path relative to the current content directory.

Cheers,
Mike

dsdsdsdsd
08-05-2009, 03:14 AM
Mike, thanks for your response;

I am trying to get to a directory that is above my current directory, so I will need some kind of .. syntax to get me up the directory hierarchy;




thanks;

walfridson
08-05-2009, 03:34 AM
parse or split the content path
array = parse("//",contentdir)
array = split(contentdir)
then just ignore the last item in the array.

dsdsdsdsd
08-05-2009, 04:15 AM
walfridson, thanks for your response;

I think what you are suggesting is slightly different than what I am working on ... I believe that you are suggesting a string-related function;

but I am working on a file-management function, specifically using a relative file path within a file-management function;

thanks though,
Shannon

Lightwolf
08-05-2009, 04:20 AM
walfridson, thanks for your response;

I think what you are suggesting is slightly different than what I am working on ... I believe that you are suggesting a string-related function;

but I am working on a file-management function, specifically using a relative file path within a file-management function;

thanks though,
Shannon
But you can build an absolute path from that suggestion and then pass that to matchdirs.

Cheers,
Mike

walfridson
08-05-2009, 05:00 AM
contpar = parse("\\",getdir("Content"));
newpath = "";
for(i=1;i<contpar.size();i++)
newpath += contpar[i] + "\\";
info(newpath);

dsdsdsdsd
08-05-2009, 05:13 AM
I suppose that if there exists a value for the getdir( "?" ) function that will return the location of the lscript itself, then I could use it;

unfortunately getdir("Content") returns the location of my LW installation, as opposed to the location of the lscript that is running;

I will look through the docs for something;

thanks,
Shannon

walfridson
08-05-2009, 05:17 AM
SCRIPTID points to the path of the script thats running.

info(SCRIPTID);

dsdsdsdsd
08-05-2009, 05:24 AM
yes it does ... how did you know about this ... I did not find it in the references: LscriptUserGuide.pdf, LScriptReference.pdf;



thanks very much to you both,
Shannon

walfridson
08-05-2009, 05:38 AM
Use this, can't remember who created it but the old homepage for it gives 404

dsdsdsdsd
08-05-2009, 05:54 AM
I did find the SCRIPTID in this new document, although it is pretty obscure;

but more importantly, this implies that Newtek is updating/improving their Lscript documentation, which will be a benefit to LW I believe;

thanks,
Shannon

Matt
08-05-2009, 05:58 AM
The ONLY LScript resource you'll ever need!

http://www.mikegreen.name/Lscript/Lscript%20Index.html

dsdsdsdsd
08-05-2009, 06:10 AM
very nice;

Red_Oddity
08-06-2009, 09:58 AM
Does
matchdirs ( "sub_dir\\.." , "*" ) ; work?