mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 13:59:31 +02:00
LazUtils: Prevent CopyDirTree copying to a subdirectory of source. Issue #28841.
git-svn-id: trunk@51033 -
This commit is contained in:
parent
81733b2e74
commit
6faa4e893c
@ -704,8 +704,11 @@ begin
|
||||
Flags:=Flags+[cffCreateDestDirectory];
|
||||
Searcher.FFlags:=Flags;
|
||||
Searcher.FCopyFailedCount:=0;
|
||||
Searcher.FSourceDir:=SetDirSeparators(SourceDir);
|
||||
Searcher.FTargetDir:=SetDirSeparators(TargetDir);
|
||||
Searcher.FSourceDir:=TrimFilename(SetDirSeparators(SourceDir));
|
||||
Searcher.FTargetDir:=TrimFilename(SetDirSeparators(TargetDir));
|
||||
// Don't even try to copy to a subdirectory of SourceDir.
|
||||
if {$if defined(Windows) or defined(darwin)}AnsiStartsText{$ELSE}AnsiStartsStr{$ENDIF}
|
||||
(SourceDir, TargetDir) then Exit;
|
||||
Searcher.Search(SourceDir);
|
||||
Result:=True;
|
||||
finally
|
||||
|
@ -32,7 +32,7 @@ unit FileUtil;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
Classes, SysUtils, strutils,
|
||||
Masks, LazUTF8, LazFileUtils;
|
||||
|
||||
{$if defined(Windows) or defined(darwin)}
|
||||
|
Loading…
Reference in New Issue
Block a user