mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:59:14 +02:00
LazUtils: Improve CopyDirTree, modified from a patch from Takeda Matsuki.
git-svn-id: trunk@37109 -
This commit is contained in:
parent
afcd11631a
commit
4507911224
@ -1007,21 +1007,25 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCopyDirTree.DoDirectoryFound;
|
||||
var
|
||||
NewPath:String;
|
||||
begin
|
||||
// ToDo: create destination path here instead of calling CopyFile with cffCreateDestDirectory.
|
||||
NewPath:=StringReplace(FileName, FSourceDir, FTargetDir, []);
|
||||
if not DirectoryExistsUTF8(NewPath) then
|
||||
if not ForceDirectoriesUTF8(NewPath) then
|
||||
Inc(FCopyFailedCount);
|
||||
end;
|
||||
|
||||
function CopyDirTree(const SourceDir, TargetDir: string;
|
||||
PreserveTime: boolean = False): Boolean;
|
||||
function CopyDirTree(const SourceDir, TargetDir: string; Flags: TCopyFileFlags=[]): Boolean;
|
||||
var
|
||||
Searcher: TCopyDirTree;
|
||||
begin
|
||||
Result:=False;
|
||||
Searcher:=TCopyDirTree.Create;
|
||||
try
|
||||
Searcher.FFlags:=[cffCreateDestDirectory];
|
||||
if PreserveTime then
|
||||
Searcher.FFlags:=Searcher.FFlags+[cffPreserveTime];
|
||||
// Destination directories are always created. User setting has no effect!
|
||||
Flags:=Flags-[cffCreateDestDirectory];
|
||||
Searcher.FFlags:=Flags;
|
||||
Searcher.FCopyFailedCount:=0;
|
||||
Searcher.FSourceDir:=SourceDir;
|
||||
Searcher.FTargetDir:=TargetDir;
|
||||
|
@ -185,8 +185,7 @@ function CopyFile(const SrcFilename, DestFilename: string;
|
||||
Flags: TCopyFileFlags=[cffOverwriteFile]): boolean;
|
||||
function CopyFile(const SrcFilename, DestFilename: string; PreserveTime: boolean): boolean;
|
||||
deprecated {$IFDEF VER2_5}'use cffPreserveTime in Flags parameter instead'{$ENDIF};
|
||||
function CopyDirTree(const SourceDir, TargetDir: string;
|
||||
PreserveTime: boolean = False): boolean;
|
||||
function CopyDirTree(const SourceDir, TargetDir: string; Flags: TCopyFileFlags=[]): Boolean;
|
||||
|
||||
// file actions
|
||||
function ReadFileToString(const Filename: string): string;
|
||||
|
Loading…
Reference in New Issue
Block a user