ADD: Error if cannot copy backward

This commit is contained in:
Alexander Koblov 2015-08-25 16:05:55 +00:00
commit ffba56d6bd
4 changed files with 24 additions and 14 deletions

View file

@ -269,6 +269,9 @@ begin
begin
LogMessage(Format(rsMsgLogSuccess + rsMsgLogPack,
[FWcxArchiveFileSource.ArchiveFileName]), [log_arc_op], lmtSuccess);
FStatistics.DoneFiles:= FStatistics.TotalFiles;
UpdateStatistics(FStatistics);
end;
// Delete temporary TAR archive if needed

View file

@ -172,7 +172,7 @@ end;
function TWfxPluginOperationHelper.ProcessFile(aFile: TFile;
AbsoluteTargetFileName: String; var Statistics: TFileSourceCopyOperationStatistics): LongInt;
var
iFlags: Integer;
iFlags: Integer = 0;
RemoteInfo: TRemoteInfo;
iTemp: TInt64Rec;
bCopyMoveIn: Boolean;
@ -186,14 +186,13 @@ begin
begin
{ FCurrentFileSize:= aFile.Size;
}
iFlags:= 0;
with RemoteInfo do
begin
iTemp.Value := (aFile.Properties[fpSize] as TFileSizeProperty).Value;
iTemp.Value := aFile.Size;
SizeLow := iTemp.Low;
SizeHigh := iTemp.High;
LastWriteTime := DateTimeToWfxFileTime((aFile.Properties[fpModificationTime] as TFileModificationDateTimeProperty).Value);
Attr := LongInt((aFile.Properties[fpAttributes] as TFileAttributesProperty).Value);
LastWriteTime := DateTimeToWfxFileTime(aFile.ModificationTime);
Attr := LongInt(aFile.Attributes);
end;
if (FMode = wpohmMove) then
iFlags:= iFlags + FS_COPYFLAGS_MOVE;
@ -221,8 +220,8 @@ begin
with Statistics do
begin
DoneFiles := DoneFiles + 1;
DoneBytes := OldDoneBytes + (aFile.Properties[fpSize] as TFileSizeProperty).Value;
if Result = FS_FILE_OK then DoneFiles := DoneFiles + 1;
DoneBytes := OldDoneBytes + aFile.Size;
UpdateStatistics(Statistics);
end;
end;

View file

@ -150,7 +150,7 @@ resourcestring
rsMsgUserDidNotSetExtension = '<NO EXT>';
rsMsgUserDidNotSetName = '<NO NAME>';
rsMsgProblemExecutingCommand = 'Problem executing command (%s)';
rsMsgCouldNotCopyBackward = 'Could not copy backward - do you want to keep the changed file %s?';
rsMsgCouldNotCopyBackward = 'Could not copy backward - do you want to keep the changed file?';
//Hot Dir related
rsMsgHotDirWhatToDelete = 'Do you want to delete all elements inside the sub-menu [%s]?'+#$0A+'Answering NO will delete only menu delimiters but will keep element inside sub-menu.';

View file

@ -56,7 +56,8 @@ uses
uShellExecute, uGlobs, uOSUtils, fEditor, fViewer, uDCUtils,
uTempFileSystemFileSource, uLng, fDiffer, uDebug, DCOSUtils, uShowMsg,
uFile, uFileSourceCopyOperation, uFileSystemFileSource,
uFileSourceOperationOptions, uOperationsManager, uFileSourceOperationTypes;
uFileSourceOperationOptions, uOperationsManager, uFileSourceOperationTypes,
uWcxArchiveFileSource, uWfxPluginFileSource;
type
@ -228,10 +229,11 @@ var
begin
with WaitData do
try
if fsoCopyIn in TargetFileSource.GetOperationsTypes then
// File was modified
if mbFileAge(FileName) <> FileTime then
begin
// File was modified
if mbFileAge(FileName) <> FileTime then
if (fsoCopyIn in TargetFileSource.GetOperationsTypes) and
((TargetFileSource is TWcxArchiveFileSource) or (TargetFileSource is TWfxPluginFileSource)) then
begin
Files:= TFiles.Create(SourceFileSource.GetRootDir);
Files.Add(TFileSystemFileSource.CreateFileFromFile(FileName));
@ -239,9 +241,15 @@ begin
// Copy file back
if Assigned(Operation) then
begin
Operation.AddStateChangedListener([fsosStopped], @OnCopyInStateChanged);
Operation.FileExistsOption:= fsoofeOverwrite;
OperationsManager.AddOperation(Operation);
WaitData:= nil; // Will be free in operation
end;
end
else if msgYesNo(rsMsgCouldNotCopyBackward + LineEnding + FileName) then
begin
(SourceFileSource as ITempFileSystemFileSource).DeleteOnDestroy:= False;
end;
end;
finally
@ -264,7 +272,7 @@ var
aFileSource: ITempFileSystemFileSource;
aCopyOperation: TFileSourceCopyOperation;
begin
if (State = fsosStopped) and (Operation.Result = fsorFinished) then
if (State = fsosStopped) then
begin
aCopyOperation := Operation as TFileSourceCopyOperation;
aFileSource := aCopyOperation.SourceFileSource as ITempFileSystemFileSource;
@ -272,7 +280,7 @@ begin
begin
if DoneFiles <> TotalFiles then
begin
if msgYesNo(Operation.Thread, Format(rsMsgCouldNotCopyBackward, [LineEnding + aCopyOperation.SourceFiles[0].FullPath])) then
if msgYesNo(Operation.Thread, rsMsgCouldNotCopyBackward + LineEnding + aCopyOperation.SourceFiles[0].FullPath) then
begin
aFileSource.DeleteOnDestroy:= False;
end;