Added DirCreate (creates entire tree) returns true/false
This commit is contained in:
parent
71a7576dde
commit
d1283eca04
|
@ -31,6 +31,7 @@ Function JustFileName (Str: String) : String;
|
||||||
Function JustFile (Str: String) : String;
|
Function JustFile (Str: String) : String;
|
||||||
Function JustFileExt (Str: String) : String;
|
Function JustFileExt (Str: String) : String;
|
||||||
Function JustPath (Str: String) : String;
|
Function JustPath (Str: String) : String;
|
||||||
|
Function DirCreate (Str: String) : Boolean;
|
||||||
Function DirExists (Str: String) : Boolean;
|
Function DirExists (Str: String) : Boolean;
|
||||||
Function DirSlash (Str: String) : String;
|
Function DirSlash (Str: String) : String;
|
||||||
Function DirChange (Dir: String) : Boolean;
|
Function DirChange (Dir: String) : Boolean;
|
||||||
|
@ -283,6 +284,37 @@ Begin
|
||||||
Result := (IoResult = 0);
|
Result := (IoResult = 0);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function DirCreate (Str: String) : Boolean;
|
||||||
|
Var
|
||||||
|
Count : Byte;
|
||||||
|
CurDir : String;
|
||||||
|
Prefix : String;
|
||||||
|
Begin
|
||||||
|
Result := True;
|
||||||
|
Prefix := '';
|
||||||
|
Str := DirSlash(Str);
|
||||||
|
|
||||||
|
Count := Pos(PathSep, Str);
|
||||||
|
|
||||||
|
While (Count > 0) Do Begin
|
||||||
|
CurDir := Copy(Str, 1, Count);
|
||||||
|
|
||||||
|
Delete (Str, 1, Count);
|
||||||
|
|
||||||
|
Prefix := Prefix + CurDir;
|
||||||
|
|
||||||
|
If Not DirExists(Prefix) Then Begin
|
||||||
|
{$I-} MkDIR (Prefix); {$I+}
|
||||||
|
If IoResult <> 0 Then Begin
|
||||||
|
Result := False;
|
||||||
|
Exit;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Count := Pos(PathSep, Str);
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
Procedure DirClean (Path: String; Exempt: String);
|
Procedure DirClean (Path: String; Exempt: String);
|
||||||
Var
|
Var
|
||||||
DirInfo: SearchRec;
|
DirInfo: SearchRec;
|
||||||
|
|
Loading…
Reference in New Issue