mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 18:39:09 +02:00
Merged revision(s) 51675 #f7005c6649 from trunk:
LazUtils: Revert r51038 #10e166f60e. Fixes bug in CopyDirTree. Issue #0029695. ........ git-svn-id: branches/fixes_1_6@51687 -
This commit is contained in:
parent
aede9c3c21
commit
c66d69cc37
@ -696,8 +696,6 @@ 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;
|
||||||
RelPath: String;
|
|
||||||
B: Boolean;
|
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result:=False;
|
||||||
Searcher:=TCopyDirTree.Create;
|
Searcher:=TCopyDirTree.Create;
|
||||||
@ -710,10 +708,11 @@ 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.
|
||||||
B := TryCreateRelativePath(LazFileUtils.ExpandFilenameUtf8(Searcher.FSourceDir),
|
{$ifdef CaseInsensitiveFilenames}
|
||||||
LazFileUtils.ExpandFilenameUtf8(Searcher.FTargetDir), False, True, RelPath);
|
if AnsiStartsText(Searcher.FSourceDir, Searcher.FTargetDir) then Exit;
|
||||||
if B and ((Copy(RelPath,1,2) = '..') or (RelPath = '')) then Exit;
|
{$ELSE}
|
||||||
|
if AnsiStartsStr(Searcher.FSourceDir, Searcher.FTargetDir) then Exit;
|
||||||
|
{$ENDIF}
|
||||||
Searcher.Search(SourceDir);
|
Searcher.Search(SourceDir);
|
||||||
Result:=Searcher.FCopyFailedCount=0;
|
Result:=Searcher.FCopyFailedCount=0;
|
||||||
finally
|
finally
|
||||||
|
@ -33,7 +33,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
Masks, LazUTF8, LazFileUtils;
|
Masks, LazUTF8, LazFileUtils, StrUtils;
|
||||||
|
|
||||||
{$if defined(Windows) or defined(darwin)}
|
{$if defined(Windows) or defined(darwin)}
|
||||||
{$define CaseInsensitiveFilenames}
|
{$define CaseInsensitiveFilenames}
|
||||||
|
Loading…
Reference in New Issue
Block a user