aqFileSystem.ExpandFileName Method

Applies to TestComplete 14.72, last modified on April 22, 2021

Description

Use the ExpandFileName method to convert the given relative file name into a fully qualified path name. This function does not support the UNC (Universal Naming Convention) format, that is, it does not support file names that start with a network resource rather than with a drive letter. To expand a UNC file name, use the ExpandUNCFileName method.

Declaration

aqFileSystem.ExpandFileName(InPath)

InPath [in]    Required    String    
Result String

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

InPath

Specifies the path that should be converted into a fully qualified path name.

If InPath specifies a folder path, it may or may not include a trailing backslash (\). You can add a trailing backslash to or remove it from the path by using the IncludeTrailingBackSlash or ExcludeTrailingBackSlash method.

Result Value

A string that holds the fully qualified version of the specified path.

Example

The code below converts the specified relative path to the fully-qualified file name.

JavaScript, JScript

function ExpandFileName()
{
  // Specifies the file path relative to the project path
  var sPath = "../../MyFiles/FileName.txt";
  
   // Converts the relative path to the fully-qualified file name
  var sExpPath = aqFileSystem.ExpandFileName(sPath);
  
   // Posts the fully-qualified file name to the test log
  Log.Message(sExpPath);
  
}

Python

def ExpandFileName():
  # Specifies the file path relative to the project path
  sPath = "../../MyFiles/FileName.txt"
  # Converts the relative path to the fully-qualified file name
  sExpPath = aqFileSystem.ExpandFileName(sPath)
  # Posts the fully-qualified file name to the test log
  Log.Message(sExpPath)

VBScript

Sub ExpandFileName

  ' Specifies the file path relative to the project path
  sPath = "../../MyFiles/FileName.txt"
  
   ' Converts the relative path to the fully-qualified file name
  sExpPath = aqFileSystem.ExpandFileName(sPath)
  
   ' Posts the fully-qualified file name to the test log
  Call Log.Message(sExpPath)
  
End Sub

DelphiScript

function ExpandFileName;
var sPath, sExpPath;
begin

  // Specifies the file path relative to the project path
  sPath := '../../MyFiles/FileName.txt';
  
   // Converts the relative path to the fully-qualified file name
   sExpPath := aqFileSystem.ExpandFileName(sPath);
  
   // Posts the fully-qualified file name to the test log
  Log.Message(sExpPath);
  
end;

C++Script, C#Script

function ExpandFileName()
{
  // Specifies the file path relative to the project path
  var sPath = "../../MyFiles/FileName.txt";
  
   // Converts the relative path to the fully-qualified file name
  var sExpPath = aqFileSystem["ExpandFileName"](sPath);
  
   // Posts the fully-qualified file name to the test log
  Log["Message"](sExpPath);
  
}

See Also

Working With Files From Scripts
ExpandUNCFileName Method

Highlight search results