Sign in Join
FPDoc Onlineexperiment

FileSetAttrUTF8 function

In unit LazFileUtils

Sets the file attribute value for the specified file name.

Declaration

pascal
function FileSetAttrUTF8(const Filename: string; Attr: LongInt)
: LongInt

Arguments

Filename

File name to update in the function.

Attr

File attribute value for the specified file name.

Function result

Last error number from the function.

Description

FileSetAttrUTF8 is a Longint function used to set the file attributes for the specified file name to the value in Attr. The value in Attr can be set by AND-ing predefined file attribute constants, such as:

faReadOnly
The file is read-only
faHidden
The file is hidden (On UNIX, the file name starts with a dot)
faSysFile
The file is a system file (On UNIX, the file is a character, block or FIFO file).
faVolumeId
Volume Label (For DOS/Windows on a plain FAT - not VFAT or Fat32)
faDirectory
File is a directory
faArchive
File is ready to be archived (Not possible on UNIX)

For UNIX-like environments, FileSetAttr in SysUtils is called to set the file attributes value. InvalidateFileStateCache is also called for the specified file name. For the Windows environment, SetFileAttributesW in Windows is called to set the attributes value for the specified file name.

The return value contains the result from GetLastError; a non-zero value indicates that an error has occurred.

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