Modify

Opened 18 years ago

Closed 18 years ago

#472 closed Bug (No Bug)

@ScriptDir returns a slash (\) when script run from root

Reported by: congo (seanw@… Owned by:
Milestone: Component: AutoIt
Version: 3.2.12.0 Severity: None
Keywords: @ScriptDir Documentation Cc:

Description

In AutoIT v3.2.12.0, @ScriptDir is documented as NOT returning a trailing slash(\), however due to the Win API if a compiled script is run from a drive root (like an autorun DVD/CD) it does infact return a trailing backslash.

Easy to work around if you can't be 100% sure of where the app will be run:

	$myscript = @ScriptDir
	If StringRight($drive, 1) == "\" Then ;in root of a drive a trailing slash is returned by Windows!
		$t = StringSplit($drive, "\")
		$myscript = $t[1]
	EndIf

The documentation may need to be updated, or the macro modified

Attachments (0)

Change History (2)

comment:1 by congo (seanw@…, 18 years ago

Sorry, ahem,

Global $myscript = @ScriptDir
If StringRight($myscript, 1) == "\" Then ;in root of a drive a trailing slash is return by Windows!
	$t = StringSplit($myscript, "\")
	$myscript = $t[1]
EndIf

comment:2 by Valik, 18 years ago

Resolution: No Bug
Status: newclosed

The choices are, return a trailing slash when run from the drive root, or return an invalid path. I don't think I need to explain any further why it does what it does.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.