aqFileSystem.ExpandUNCFileName Method

Applies to TestComplete 15.46, last modified on January 09, 2023

Description

Use the ExpandUNCFileName method to convert the given relative file name into a fully qualified path name.

For network files, this function returns a fully qualified path name using the Universal Naming Convention (UNC). This convention implies that a UNC file name includes the name of the network resource to which the drive is mapped, instead of the drive prefix.

For files on local disks, ExpandUNCFileName is an equivalent to the ExpandFileName method.

Declaration

aqFileSystem.ExpandUNCFileName(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 a relative file name to a fully qualified file name using Universal Naming Convention.

JavaScript, JScript

function ExpandUNCFileNameExample()
{
   // Specifies the relative path to a file
  sPath = "../../ShareFolder/FileName.txt";
  
   // Converts the relative path to the fully qualified file name using UNC
  sExpUNCPath = aqFileSystem.ExpandUNCFileName(sPath);
  
   // Posts the fully qualified UNC file name to the test log
  Log.Message(sExpUNCPath);
  
}

Python

def ExpandUNCFileNameExample():
  # Specifies the relative path to a file
  sPath = "../../ShareFolder/FileName.txt"
  # Converts the relative path to the fully qualified file name using UNC
  sExpUNCPath = aqFileSystem.ExpandUNCFileName(sPath)
  # Posts the fully qualified UNC file name to the test log
  Log.Message(sExpUNCPath)

VBScript

Sub ExpandUNCFileNameExample

   ' Specifies the relative path to a file
  sPath = "../../ShareFolder/FileName.txt"
  
   ' Converts the relative path to the fully qualified file name using UNC
  sExpUNCPath = aqFileSystem.ExpandUNCFileName(sPath)
  
   ' Posts the fully qualified UNC file name to the test log
  Call Log.Message(sExpUNCPath)
  
End Sub

DelphiScript

function ExpandUNCFileNameExample;
var sPath, sExpUNCPath;
begin

   // Specifies the relative path to a file
  sPath := '../../ShareFolder/FileName.txt';
  
   // Converts the relative path to the fully qualified file name using UNC
  sExpUNCPath := aqFileSystem.ExpandUNCFileName(sPath);
  
   // Posts the fully qualified UNC file name to the test log
  Log.Message(sExpUNCPath);
  
end;

C++Script, C#Script

function ExpandUNCFileNameExample()
{
   // Specifies the relative path to a file
  sPath = "../../ShareFolder/FileName.txt";
  
   // Converts the relative path to the fully qualified file name using UNC
  sExpUNCPath = aqFileSystem["ExpandUNCFileName"](sPath);
  
   // Posts the fully qualified UNC file name to the test log
  Log["Message"](sExpUNCPath);
  
}

See Also

Working With Files From Scripts
ExpandFileName Method

Highlight search results