mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: WCX-plugins - Don't show zero file size when size is unknown
(cherry picked from commit 024b0d632f)
This commit is contained in:
parent
de5434328a
commit
b8f358ace5
4 changed files with 46 additions and 6 deletions
|
|
@ -283,6 +283,7 @@ end;
|
|||
function FileExistsMessage(const TargetName, SourceName: String;
|
||||
SourceSize: Int64; SourceTime: TDateTime): String;
|
||||
var
|
||||
ASize: String;
|
||||
TargetInfo: TFileAttributeData;
|
||||
begin
|
||||
Result:= rsMsgFileExistsOverwrite + LineEnding + WrapTextSimple(TargetName, 100) + LineEnding;
|
||||
|
|
@ -291,8 +292,13 @@ begin
|
|||
Result:= Result + Format(rsMsgFileExistsFileInfo, [IntToStrTS(TargetInfo.Size),
|
||||
DateTimeToStr(FileTimeToDateTime(TargetInfo.LastWriteTime))]) + LineEnding;
|
||||
end;
|
||||
if (SourceSize < 0) then
|
||||
ASize:= '?'
|
||||
else begin
|
||||
ASize:= IntToStrTS(SourceSize);
|
||||
end;
|
||||
Result:= Result + LineEnding + rsMsgFileExistsWithFile + LineEnding + WrapTextSimple(SourceName, 100) + LineEnding +
|
||||
Format(rsMsgFileExistsFileInfo, [IntToStrTS(SourceSize), DateTimeToStr(SourceTime)]);
|
||||
Format(rsMsgFileExistsFileInfo, [ASize, DateTimeToStr(SourceTime)]);
|
||||
end;
|
||||
|
||||
function FileCopyProgress(TotalBytes, DoneBytes: Int64; UserData: Pointer): LongBool;
|
||||
|
|
|
|||
|
|
@ -337,7 +337,11 @@ begin
|
|||
begin
|
||||
CurrentFileFrom := Header.FileName;
|
||||
CurrentFileTo := TargetFileName;
|
||||
CurrentFileTotalBytes := Header.UnpSize;
|
||||
if (Header.UnpSize < 0) then
|
||||
CurrentFileTotalBytes := 0
|
||||
else begin
|
||||
CurrentFileTotalBytes := Header.UnpSize;
|
||||
end;
|
||||
CurrentFileDoneBytes := -1;
|
||||
|
||||
UpdateStatistics(FStatistics);
|
||||
|
|
@ -477,7 +481,10 @@ begin
|
|||
begin
|
||||
if ((MaskList = nil) or MaskList.Matches(ExtractFileNameEx(Header.FileName))) then
|
||||
begin
|
||||
Inc(FStatistics.TotalBytes, Header.UnpSize);
|
||||
if (Header.UnpSize > 0) then
|
||||
begin
|
||||
Inc(FStatistics.TotalBytes, Header.UnpSize);
|
||||
end;
|
||||
Inc(FStatistics.TotalFiles, 1);
|
||||
|
||||
CurrentFileName := ExtractDirLevel(CurrentArchiveDir, ExtractFilePathEx(Header.FileName));
|
||||
|
|
@ -616,6 +623,14 @@ const
|
|||
= (fsourOverwrite, fsourSkip, fsourOverwriteLarger, fsourOverwriteAll,
|
||||
fsourSkipAll, fsourOverwriteSmaller, fsourOverwriteOlder, fsourCancel,
|
||||
fsourRenameSource, fsourAutoRenameSource);
|
||||
ResponsesNoSize: array[0..8] of TFileSourceOperationUIResponse
|
||||
= (fsourOverwrite, fsourSkip, fsourRenameSource,
|
||||
fsourOverwriteAll, fsourSkipAll, fsourAutoRenameSource,
|
||||
fsourOverwriteOlder, fsourCancel, fsouaCompare);
|
||||
ResponsesNoSizeNoCompare: array[0..7] of TFileSourceOperationUIResponse
|
||||
= (fsourOverwrite, fsourSkip, fsourRenameSource,
|
||||
fsourOverwriteAll, fsourSkipAll, fsourAutoRenameSource,
|
||||
fsourOverwriteOlder, fsourCancel);
|
||||
var
|
||||
PossibleResponses: TFileSourceOperationUIResponses;
|
||||
Answer: Boolean;
|
||||
|
|
@ -655,8 +670,22 @@ begin
|
|||
// Can't asynchoronously extract file for comparison when multiple operations are not supported
|
||||
// TODO: implement synchronous CopyOut to temp directory or close the connection until the question is answered
|
||||
case FNeedsConnection of
|
||||
True : PossibleResponses := ResponsesNoCompare;
|
||||
False: PossibleResponses := Responses;
|
||||
True :
|
||||
begin
|
||||
if (Header.UnpSize < 0) then
|
||||
PossibleResponses := ResponsesNoSizeNoCompare
|
||||
else begin
|
||||
PossibleResponses := ResponsesNoCompare;
|
||||
end;
|
||||
end;
|
||||
False:
|
||||
begin
|
||||
if (Header.UnpSize < 0) then
|
||||
PossibleResponses := ResponsesNoSize
|
||||
else begin
|
||||
PossibleResponses := Responses;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Message:= FileExistsMessage(AbsoluteTargetFileName, Header.FileName,
|
||||
Header.UnpSize, WcxFileTimeToDateTime(Header.FileTime));
|
||||
|
|
|
|||
|
|
@ -474,6 +474,7 @@ begin
|
|||
else
|
||||
begin
|
||||
SizeProperty := TFileSizeProperty.Create(WcxHeader.UnpSize);
|
||||
SizeProperty.IsValid := (WcxHeader.UnpSize >= 0);
|
||||
CompressedSizeProperty := TFileCompressedSizeProperty.Create(WcxHeader.PackSize);
|
||||
end;
|
||||
ModificationTimeProperty := TFileModificationDateTimeProperty.Create(0);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,11 @@ begin
|
|||
with FStatistics do
|
||||
begin
|
||||
CurrentFile := Header.FileName;
|
||||
CurrentFileTotalBytes := Header.UnpSize;
|
||||
if (Header.UnpSize < 0) then
|
||||
CurrentFileTotalBytes := 0
|
||||
else begin
|
||||
CurrentFileTotalBytes := Header.UnpSize;
|
||||
end;
|
||||
CurrentFileDoneBytes := -1;
|
||||
|
||||
UpdateStatistics(FStatistics);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue