[Overview][Constants][Types][Procedures and functions][Variables][Index] Reference for unit 'LazFileUtils' (#lazutils)

SwitchPathDelims

Replaces path delimiters in a file path with the specified delimiter.

Declaration

Source position: lazfileutils.pas line 96

function SwitchPathDelims(

  const Filename: string;

  Switch: TPathDelimSwitch

):string;

function SwitchPathDelims(

  const Filename: string;

  Switch: Boolean

):string;

Arguments

Filename

  

File path and name examined in the function.

Switch

  

Indicates the desired path delimiter to use in the return value.

Function result

File path and name after any path delimiter substitutions.

Arguments

Filename

  

File path and name examined in the function.

Switch

  

Indicates the desired path delimiter to use in the return value.

Description

SwitchPathDelims is an overloaded String function used to ensure that path delimiter characters in Filename use the required character.

One variant of the function uses the Switch argument to pass a TPathDelimSwitch enumeration value that identifies the path delimiter needed, and includes the following:

pdsNone
No path delimiter substitutions are performed. The original value in Filename is used as the return value for the function.
pdsSystem
Path delimiters use the character required for the current platform or environment running the application.
pdsUnix
Path delimiters use the UNIX forward slash (/) character.
pdsWindows
Path delimiters use the Windows backslash (\) character.

The function examines each character in Filename are replaces any path delimiters encountered with the value specified in Switch.

The other variant passes a Boolean value indicating if all occurrences of a path delimiter should use the character required for the platform or environment hosting the application. It calls the SwitchPathDelims function to perform the substitutions.

The return value contains the value from Filename after any path delimiter substitutions have been applied.

See also

TPathDelimSwitch

  

Represents the platform- or OS-specific path delimiters available in the Lazarus LCL.

SwitchPathDelims

  

Replaces path delimiters in a file path with the specified delimiter.


Version 3.2 Generated 2024-02-25 Home