Bladeren bron

FIX: Bug [0002646] Incorrect total file copy progress

Alexander Koblov 4 jaren geleden
bovenliggende
commit
07ee7f0711
1 gewijzigde bestanden met toevoegingen van 9 en 2 verwijderingen
  1. 9 2
      src/filesources/filesystem/ufilesystemutil.pas

+ 9 - 2
src/filesources/filesystem/ufilesystemutil.pas

@@ -1247,11 +1247,12 @@ end;
 
 function TFileSystemOperationHelper.ProcessFile(aNode: TFileTreeNode; AbsoluteTargetFileName: String): Boolean;
 var
-  OldDoneBytes: Int64; // for if there was an error
+  OldDoneBytes, OldTotalBytes: Int64; // for if there was an error
 begin
   // If there will be an error the DoneBytes value
   // will be inconsistent, so remember it here.
   OldDoneBytes := FStatistics.DoneBytes;
+  OldTotalBytes := FStatistics.TotalBytes;
 
   // Skip descript.ion, it will be processed below
   if gProcessComments and (FStatistics.TotalFiles > 1) and mbCompareFileNames(aNode.TheFile.Name, DESCRIPT_ION) then
@@ -1322,7 +1323,13 @@ begin
   with FStatistics do
   begin
     DoneFiles := DoneFiles + 1;
-    DoneBytes := OldDoneBytes + aNode.TheFile.Size;
+    if not Result then
+    begin
+      DoneBytes := OldDoneBytes + aNode.TheFile.Size;
+      // Increase DoneBytes twice when copy file or move file between different partitions
+      if FVerify and ((FMode = fsohmCopy) or (OldTotalBytes <> TotalBytes)) then
+        DoneBytes += aNode.TheFile.Size;
+    end;
     UpdateStatistics(FStatistics);
   end;
 end;