Merged revision(s) 64845 #966ee04907 from trunk:

LazUtils: in CopyDirTree() add a PathDelim to both SourceDir and TarGetDir before testing wether TarGetDir is a subdirectory of SourceDir. Issue #0038644.
........

git-svn-id: branches/fixes_2_0@64894 -
This commit is contained in:
maxim 2021-03-29 22:38:41 +00:00
parent 4d2d7125fd
commit 71b130e9da

View File

@ -325,10 +325,11 @@ begin
Searcher.FTargetDir:=TrimFilename(SetDirSeparators(TargetDir));
// Don't even try to copy to a subdirectory of SourceDir.
//append a pathedelim, otherwise CopyDirTree('/home/user/foo','/home/user/foobar') will fail at this point. Issue #0038644
{$ifdef CaseInsensitiveFilenames}
if AnsiStartsText(Searcher.FSourceDir, Searcher.FTargetDir) then Exit;
if AnsiStartsText(AppendPathDelim(Searcher.FSourceDir), AppendPathDelim(Searcher.FTargetDir)) then Exit;
{$ELSE}
if AnsiStartsStr(Searcher.FSourceDir, Searcher.FTargetDir) then Exit;
if AnsiStartsStr(AppendPathDelim(Searcher.FSourceDir), AppendPathDelim(Searcher.FTargetDir)) then Exit;
{$ENDIF}
Searcher.Search(SourceDir);
Result:=Searcher.FCopyFailedCount=0;