Sign in Join
FPDoc Onlineexperiment

ExtractUNCVolume function

In unit LazFileUtils

Gets UNC host and volume name used in the specified path.

Declaration

pascal
function ExtractUNCVolume(const Path: string): string

Description

ExtractUNCVolume is a String function used to get host and volume information from a path specified using Universal Naming Convention (UNC). UNC notation is recognized using both the long and short formats defined for the naming convention.

The return value contains information needed to access shared resources by their host and volume names, and contains one of the following formats:

\\server-name\shared-resource-path-name\
\\mypc\nas-drive\
\\?\c:\
\\?\UNC\c:\

ExtractUNCVolume calls the IsUNCPath function to determine if the value in Path starts with the UNC naming delimiters. The return value is an empty string (''), and no additional actions are performed in the function, when Path does not use UNC notation.

ExtractUNCVolume examines the characters in Path to determine if it uses the long or the short format for UNC notation. Long format notation begins with the characters '\\?\' or '\\?\UNC\' followed by a drive designation and optional path information such as 'c:\'. Short format notation uses a host name and a shared resource identifier such as '\\mypc\nas-drive\'.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.