Jump to content
Sign in to follow this  
corz

@ScriptDir returns path WITH a slash. what?

Recommended Posts

corz

If the script is in the root of a drive, a slash is added to the path!!!

The manual clearly states "Directory containing the running script. (Result does not contain a trailing backslash)"

That's an hour I'll never get back! ..as they say on the imdb.

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
BrettF

True that... mmmm... Workaround:

MsgBox (0, "", _ScriptDir())

Func _ScriptDir()
    $str = @ScriptDir
    If StringRight($str, 1) = "\"  Then
        $str = StringTrimRight($str, 1)
    EndIf
    Return $str
EndFunc  ;==>_ScriptDir

Share this post


Link to post
Share on other sites
corz

Oh, I already have one of those!

Weird how no one's noticed this before, eh!

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
jvanegmond

I think it's Windows behavior. If you open Explorer, and you'll go to C: you'll see that the address bar display C:\. If you then go to the Windows folder it displays C:\Windows.

Even the command window does this:

C:\>cd windows

C:\WINDOWS>
Edited by Manadar

Share this post


Link to post
Share on other sites
corz

Yes, it is Windows. I realize that.

But if the manual states specifically that the slash is removed, then AutoIt should be ensure that it is!

And evidently the default value returned doesn't work under all situations, or else I'd have never realized there was a bug, would I?

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
Valik

It is a known problem and it's not a bug. Would you rather us return invalid paths when at the drive root? Because "C:" is an invalid path.

This is not going to be fixed. At best there will be a note added to the documentation.

Share this post


Link to post
Share on other sites
corz

That's good enough.

;o)

(or


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×