Hier mal der Code abschnitt.
Delphi-Quellcode:
function ForceDirectories(Dir: string): Boolean;
var
E: EInOutError;
begin
Result := True;
if Dir = '' then
begin
E := EInOutError.CreateRes(@SCannotCreateDir);
E.ErrorCode := 3;
raise E;
end;
Dir := ExcludeTrailingPathDelimiter(Dir);
{$IFDEF MSWINDOWS}
if (Length(Dir) < 3) or DirectoryExists(Dir)
or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
{$ENDIF}
{$IFDEF LINUX}
if (Dir = '') or DirectoryExists(Dir) then Exit;
{$ENDIF}
Result := ForceDirectories(ExtractFilePath(Dir)) and CreateDir(Dir);
end;