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

ForceDirectory

Creates the specified directory if it does not already exist.

Declaration

Source position: lazfileutils.pas line 48

function ForceDirectory(

  DirectoryName: string

):Boolean;

Arguments

DirectoryName

  

Path information for the operation.

Function result

Returns True if directory exists or if it was successfully created.

Description

ForceDirectory is a Boolean function which creates the specified directory if it does not already exist. ForceDirectory ensures that a trailing path delimiter exists in DirectoryName prior to checking the file system. Duplicate adjacent path delimiters (like '//foo//bar/foobar/' or '\\foo\\bar\foobar\') are removed prior to checking the directory path.

Each directory in the specified path is validated by calling DirPathExists. ForceDirectory calls CreateDirUTF8 if a directory does not exist, and may exit with a return value of False if directory creation is not successful.

The return value is True if all directories in the path information already exist, or are successfully created in the function.

See also

ForceDirectoriesUTF8

  

Creates the directories specified in Dir if they do not already exist.

DirPathExists

  

Indicates if the specified directory name exists on the local file system.

CreateDirUtf8

  

Creates a new directory with the specified name.


Version 3.2 Generated 2024-02-25 Home