Fix size formatting

This commit is contained in:
Matéo Duparc 2021-12-20 20:24:07 +01:00
parent bd4c935c4c
commit 7ca9398766
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E

View File

@ -89,8 +89,8 @@ object PathUtils {
if (size <= 0) {
return "0 B"
}
val digitGroups = (log10(size.toDouble()) / log10(1024.0)).toInt()
return DecimalFormat("#,##0.#").format(size / 1024.0.pow(digitGroups.toDouble())
val digitGroups = (log10(size.toDouble()) / log10(1000.0)).toInt()
return DecimalFormat("#,##0.#").format(size / 1000.0.pow(digitGroups.toDouble())
) + " " + units[digitGroups]
}