Sign in Join
FPDoc Onlineexperiment

SwitchPathDelims function

In unit LazFileUtils

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

Declaration

pascal
function SwitchPathDelims(const Filename: string; 
 Switch: TPathDelimSwitch): 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.

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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.