mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: The function "Show Occupied Space" does not distinguish between 0-size directories and non-accessible directories (issue #1846)
(cherry picked from commit e32c0398f3)
This commit is contained in:
parent
d93942deab
commit
c45365d1bc
5 changed files with 22 additions and 4 deletions
|
|
@ -320,7 +320,9 @@ end;
|
|||
|
||||
function TfrmFileProperties.FormatSize(ASize: Int64): String;
|
||||
begin
|
||||
if gFileSizeFormat in [fsfByte, fsfPersonalizedByte] then
|
||||
if (ASize < 0) then
|
||||
Result:= '???'
|
||||
else if gFileSizeFormat in [fsfByte, fsfPersonalizedByte] then
|
||||
Result:= cnvFormatFileSize(ASize)
|
||||
else begin
|
||||
Result:= Format('%s (%s)', [cnvFormatFileSize(ASize), IntToStrTS(ASize)]);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ type
|
|||
TFileSystemCalcStatisticsOperation = class(TFileSourceCalcStatisticsOperation)
|
||||
|
||||
private
|
||||
FErrorCount: Integer;
|
||||
FStatistics: TFileSourceCalcStatisticsOperationStatistics; // local copy of statistics
|
||||
|
||||
procedure ProcessFile(aFile: TFile);
|
||||
|
|
@ -38,7 +39,7 @@ implementation
|
|||
|
||||
uses
|
||||
uFileSourceOperationOptions, DCOSUtils, uLng, uFindEx,
|
||||
uFileSystemFileSource;
|
||||
uFileSystemFileSource, uFileProperty, uOSUtils;
|
||||
|
||||
constructor TFileSystemCalcStatisticsOperation.Create(
|
||||
aTargetFileSource: IFileSource;
|
||||
|
|
@ -67,6 +68,11 @@ begin
|
|||
ProcessFile(Files[CurrentFileIndex]);
|
||||
CheckOperationState;
|
||||
end;
|
||||
if (FStatistics.Size = 0) and (FErrorCount > 0) then
|
||||
begin
|
||||
FStatistics.Size := FOLDER_SIZE_ERRO;
|
||||
UpdateStatistics(FStatistics);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFileSystemCalcStatisticsOperation.ProcessFile(aFile: TFile);
|
||||
|
|
@ -160,7 +166,11 @@ var
|
|||
begin
|
||||
FindResult := FindFirstEx(srcPath + '*', 0, sr);
|
||||
try
|
||||
if FindResult = 0 then
|
||||
if FindResult <> 0 then
|
||||
begin
|
||||
if AccessDenied(FindResult) then Inc(FErrorCount);
|
||||
end
|
||||
else
|
||||
repeat
|
||||
if (sr.Name='.') or (sr.Name='..') then Continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ begin
|
|||
FOLDER_SIZE_ZERO: Result := '0';
|
||||
FOLDER_SIZE_WAIT: Result := '??';
|
||||
FOLDER_SIZE_CALC: Result := '--';
|
||||
FOLDER_SIZE_ERRO: Result := '0?';
|
||||
end;
|
||||
end
|
||||
else if AFile.SizeProperty.IsValid then
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ const
|
|||
FOLDER_SIZE_ZERO = -1;
|
||||
FOLDER_SIZE_WAIT = -2;
|
||||
FOLDER_SIZE_CALC = -3;
|
||||
FOLDER_SIZE_ERRO = -4;
|
||||
|
||||
type
|
||||
|
||||
|
|
|
|||
|
|
@ -560,7 +560,11 @@ begin
|
|||
CalcStatisticsOperationStatistics := CalcStatisticsOperation.RetrieveStatistics;
|
||||
with CalcStatisticsOperationStatistics do
|
||||
begin
|
||||
msgOK(Format(rsSpaceMsg, [Files, Directories, cnvFormatFileSize(Size), IntToStrTS(Size)]));
|
||||
if Size < 0 then
|
||||
msgOK(Format(rsSpaceMsg, [Files, Directories, '???', '???']))
|
||||
else begin
|
||||
msgOK(Format(rsSpaceMsg, [Files, Directories, cnvFormatFileSize(Size), IntToStrTS(Size)]));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue