rudi Posted April 7, 2008 Share Posted April 7, 2008 Hi.The Macro Reference tells for the macro @ScriptDir:@ScriptDir: Directory containing the running script. (Result does not contain a trailing backslash) I just recognized, that @ScriptDir DOES return a trailing backslash when the script is runned from a drive's root directory. So when I add other relative path information to the return string of @ScriptDir(), I have to check for double Backslashes like this, as the script might be runned from the root folder of update CDs:; some script doing several updates from CDROM, maybe the stript is started from<cdrom>:\ $RelPath="\Data\DLLs\" $SrcDir=StringReplace(@ScriptDir & $RelPath,"\\","\")Of course I'm aware that a "<driveletter>:" is just the drive's current directory, which might be a path not pointing to the drive's root folder. But IMHO either the trailing backslash should be added for both, the ROOT folder and all subfolders, or for none of both... Minor bug?Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
zorphnog Posted April 7, 2008 Share Posted April 7, 2008 I noticed this the other day, but in my experience it hasn't caused any functionality issues. Link to comment Share on other sites More sharing options...
DarkMatter Posted April 7, 2008 Share Posted April 7, 2008 (edited) @ScriptDir says Directory containing the running script. A drive would not be a directory. I have run into this issue with other programming languages as well. If your script and/or application is being run from a drive and you look at the @ScriptDir, or Application.ExecutablePath for some .NET applications, it will always return the Drive:\ This is what I do to check for this in AutoIT Func NeedSlash($sPath, $sDelim="\") If StringRight($sPath, 1) <> $sDelim Then $sPath &= $sDelim EndIf Return($sPath) EndFunc Just call the above function and if it NEEDS a \ it will add it, if it does not need it it will just return what was passed to it. Edited April 7, 2008 by DarkMatter [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now