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

CheckIfFileIsSymlink

Checks whether the specified file name is a symbolic link on the local file system.

Declaration

Source position: lazfileutils.pas line 50

procedure CheckIfFileIsSymlink(

  const AFilename: string

);

Arguments

AFilename

  

File name examined in the routine.

Description

CheckIfFileIsSymlink is a routine used to ensure that the file name specified in AFilename is a valid symbolic link on the local file system. It acts as an assert for the pre-condition.

The implementation for the routine is platform- or OS-specific. In general, all of the platforms raise an exception if the file name does not exist on the local file system of when the file name is not a symbolic link. The mechanism used to check for a symbolic link is platform-dependent.

For the Windows platform, the file name must be a link create using mklink on the local file system.

For UNIX-like platforms, the FpReadLink routine is called to examine the file name. The value from fpGetErrNo is used to get specific error information that can be used in the exception. For example:

ESysEAcces
Read access is denied for the symbolic link.
ESysENoEnt
A directory does not exist or is a dangling symbolic link.
ESysENotDir
A value in the file name is not a directory.
ESysENoMem
Insufficient memory to a access the symbolic link.
ESysELoopy
A circular reference was detected in the symbolic link.

Calling CheckIfFileIsSymlink on the Amiga platform will always result in an exception. Symbolic links are not supported on the Amiga platform.

Errors

Raises an exception if the specified file does not exist on the local file system, or the file is a regular file and not a symbolic link.


Version 3.2 Generated 2024-02-25 Home