LazUtils: Fix r51038 #10e166f60e for Issue #28841.

git-svn-id: trunk@51039 -
This commit is contained in:
bart 2015-12-26 13:50:01 +00:00
parent 10e166f60e
commit b8d42c3a62

View File

@ -696,7 +696,8 @@ end;
function CopyDirTree(const SourceDir, TargetDir: string; Flags: TCopyFileFlags=[]): Boolean; function CopyDirTree(const SourceDir, TargetDir: string; Flags: TCopyFileFlags=[]): Boolean;
var var
Searcher: TCopyDirTree; Searcher: TCopyDirTree;
Dummy: String; RelPath: String;
B: Boolean;
begin begin
Result:=False; Result:=False;
Searcher:=TCopyDirTree.Create; Searcher:=TCopyDirTree.Create;
@ -709,8 +710,9 @@ begin
Searcher.FTargetDir:=LazFileUtils.TrimFilename(SetDirSeparators(TargetDir)); Searcher.FTargetDir:=LazFileUtils.TrimFilename(SetDirSeparators(TargetDir));
// Don't even try to copy to a subdirectory of SourceDir. // Don't even try to copy to a subdirectory of SourceDir.
if TryCreateRelativePath(LazFileUtils.ExpandFilenameUtf8(Searcher.FSourceDir), B := TryCreateRelativePath(LazFileUtils.ExpandFilenameUtf8(Searcher.FSourceDir),
LazFileUtils.ExpandFilenameUtf8(Searcher.FTargetDir), False, True, {%H-}Dummy) then Exit; LazFileUtils.ExpandFilenameUtf8(Searcher.FTargetDir), False, True, RelPath);
if B and not ((Copy(RelPath,1,2) <> '..') and (RelPath <> '')) then Exit;
Searcher.Search(SourceDir); Searcher.Search(SourceDir);
Result:=Searcher.FCopyFailedCount=0; Result:=Searcher.FCopyFailedCount=0;