Sign in Join
FPDoc Onlineexperiment

DirectoryIsWritable function

In unit LazFileUtils

Indicates if the specified directory name is writable.

Declaration

pascal
function DirectoryIsWritable(const DirectoryName: string): Boolean

Description

DirectoryIsWritable is a Boolean function used to determine if the specified directory name is writable in the file system. The path name in DirectoryName must already exist on the local file system. The return value is False if a directory with the specified name does not exist.

The return value is True when a file can be added, deleted, or modified in the specified path. To get the return value, DirectoryIsWritable creates a temporary file in DirectoryName, adds content to it, and deletes the temporary file. DirectoryIsWritable calls the FileCreateUTF8, FileWrite, FileClose, and DeleteFileUTF8 routines to perform the file operations. The return value is True when FileWrite completes successfully.

DirectoryIsWritable calls InvalidateFileStateCache with the temporary file name if DeleteFileUTF8 cannot remove the file.

See also

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