SystemMkDir (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example creates a directory using the path and directory name entered in the text edit. The path is relative to the project directory. Type in the name of an existing directory to induce the error.

Code

procedure TForm1.Button1Click(Sender: TObject);
begin
  {$I-}
  { Get the directory name from the TEdit control. }
  MkDir(Edit1.Text);
  if IOResult <> 0 then
    MessageDlg('Cannot create directory', mtWarning, [mbOk], 0, mbOk)
  else
    MessageDlg('New directory created', mtInformation, [mbOk], 0, mbOk);
end;

Uses