mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Combining to file with one of the part's full name fails with deleting this part (fixes #1198)
This commit is contained in:
parent
bc8f7ac3c2
commit
70bdd45fa4
2 changed files with 31 additions and 2 deletions
|
|
@ -51,7 +51,7 @@ uses
|
|||
|
||||
//DC
|
||||
uOSUtils, DCOSUtils, uLng, uFileSystemUtil, uFileSystemFileSource,
|
||||
uFileProcs, uAdministrator, DCConvertEncoding;
|
||||
DCBasicTypes, uAdministrator, DCConvertEncoding;
|
||||
|
||||
{ TFileSystemCombineOperation.Create }
|
||||
constructor TFileSystemCombineOperation.Create(aFileSource: IFileSource;
|
||||
|
|
@ -136,6 +136,7 @@ end;
|
|||
{ TFileSystemCombineOperation.MainExecute }
|
||||
procedure TFileSystemCombineOperation.MainExecute;
|
||||
var
|
||||
Attrs: TFileAttrs;
|
||||
aFile, DynamicNextFile: TFile;
|
||||
CurrentFileIndex: Integer;
|
||||
iTotalDiskSize, iFreeDiskSize: Int64;
|
||||
|
|
@ -155,6 +156,24 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
Attrs:= FileGetAttrUAC(TargetFile);
|
||||
if Attrs <> faInvalidAttributes then
|
||||
begin
|
||||
if FPS_ISDIR(Attrs) then
|
||||
begin
|
||||
AskQuestion(Format(rsMsgErrDirExists, [TargetFile]), '',
|
||||
[fsourAbort], fsourAbort, fsourAbort, nil);
|
||||
RaiseAbortOperation;
|
||||
end;
|
||||
|
||||
if AskQuestion(Format(rsMsgFileExistsRwrt, [TargetFile]), '',
|
||||
[fsourOverwrite, fsourAbort], fsourOverwrite, fsourAbort,
|
||||
nil) <> fsourOverwrite then
|
||||
begin
|
||||
RaiseAbortOperation;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Create destination file
|
||||
TargetFileStream := TFileStreamUAC.Create(TargetFile, fmCreate);
|
||||
try
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ uses
|
|||
LCLProc, Controls,
|
||||
//DC
|
||||
DCStrUtils, uLng, uFileProcs, uOperationsManager, uFileSourceCombineOperation,
|
||||
uGlobs;
|
||||
DCOSUtils, uShowMsg, uGlobs;
|
||||
|
||||
{ ShowLinkerFilesForm:
|
||||
"TMainCommands.cm_FileLinker" function from "uMainCommands.pas" is calling this routine.}
|
||||
|
|
@ -123,6 +123,16 @@ begin
|
|||
ADirectory:= ExcludeTrailingBackslash(aFiles.Path);
|
||||
end;
|
||||
|
||||
for I:= 0 to lstFile.Count - 1 do
|
||||
begin
|
||||
with lstFile.Items do
|
||||
if mbCompareFileNames(TFile(Objects[I]).FullPath, AFileName) then
|
||||
begin
|
||||
msgError(Format(rsMsgCanNotCopyMoveItSelf, [AFileName]));
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if mbForceDirectory(ADirectory) then
|
||||
try
|
||||
// Fill file list with new file order
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue