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: trunk@64845 -
This commit is contained in:
bart 2021-03-20 16:55:26 +00:00
parent 32d3a2159b
commit 966ee04907

View File

@ -331,10 +331,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;