GetAbsolutePathName Method

 

Description

 

Returns complete and unambiguous path from a provided path specification.

 

PowerBASIC Syntax

 

METHOD GetAbsolutePathName ( _

BYVAL bstrPathSpec AS STRING _

) AS STRING

 

Arguments

 

bstrPathSpec

BSTR. Path specification to change to a complete and unambiguous path.

 

Return Value

 

BSTR. The path name.

 

Remarks

 

A path is complete and unambiguous if it provides a complete reference from the root of the specified drive. A complete path can only end with a path separator character (\) if it specifies the root folder of a mapped drive.

 

Assuming the current directory is c:\mydocuments\reports, the following table illustrates the behavior of the GetAbsolutePathName method.

 

pathspec (JScript)

pathspec (VBScript)

Returned path

"c:"

"c:"

"c:\mydocuments\reports"

"c:.."

"c:.."

"c:\mydocuments"

"c:\\"

"c:\"

"c:\"

"c:*.*\\may97"

"c:*.*\may97"

"c:\mydocuments\reports\*.*\may97"

"region1"

"region1"

"c:\mydocuments\reports\region12

"c:\\..\\..\\mydocuments"

"c:\..\..\mydocuments"

"c:\mydocuments"

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

DIM strName AS STRING

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Get the absolute path name from a path

strName = fso.GetAbsolutePathName (UCODE$("C:\MyFolder\Test.txt"))

 

Valid XHTML 1.0 Transitional