DirectoryInfo.Attach

Syntax

Attach(Path: String);

Parameters

Path. Directory, with which an object of this class is linked.

Description

The Attach constructor creates an object that is used to work with directories and links it with a directory, path to which is passed by the Path parameter.

Comments

A directory specified in the Path parameter may be absent. Use the Exists method to check if the directory exists.

Example

Sub UserProc;
Var
    Dir: IDirectoryInfo;
Begin
    Dir := New DirectoryInfo.Attach("c:\New_folder");
    If Not Dir.Exists Then
        Dir.Create;
    End If;
    Dispose Dir;
End Sub UserProc;

After executing the example the New_folder directory is created if it does not exist.

See also:

DirectoryInfo