Import format_size and format_size_number from old launcher, improved Task progress reporting, use aggressively cached file verification for Task unless we're running a repair (speed up updating)

This commit is contained in:
2026-10-17 09:24:30 -05:00
parent 13a782aabf
commit c0dedac4a4
4 changed files with 97 additions and 19 deletions

View File

@@ -6,4 +6,21 @@ module W3DHubLauncher
"/etc/ssl/ca-bundle.pem" # Some other distros
].find { |path| File.exist?(path) }
end
def self.format_size(bytes)
case bytes
when 0..1023 # Bytes
"#{bytes} B"
when 1024..1_048_575 # KiloBytes
"#{format_size_number(bytes / 1024.0)} KB"
when 1_048_576..1_073_741_999 # MegaBytes
"#{format_size_number(bytes / 1_048_576.0)} MB"
else # GigaBytes
"#{format_size_number(bytes / 1_073_742_000.0)} GB"
end
end
def self.format_size_number(i)
format("%0.2f", i)
end
end