Jump to content

@ScriptDir returns path WITH a slash. what?


corz
 Share

Recommended Posts

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..

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...