improve size change display
This commit is contained in:
parent
cd1cb52652
commit
04539d1671
2 changed files with 10 additions and 12 deletions
14
Backend.hs
14
Backend.hs
|
@ -192,15 +192,7 @@ checkKeySize key = do
|
|||
then return True
|
||||
else do
|
||||
dest <- moveBad key
|
||||
warning $ badsizeNote dest size size'
|
||||
warning $ "Bad file size (" ++
|
||||
compareSizes True size size' ++
|
||||
"); moved to " ++ dest
|
||||
return False
|
||||
|
||||
badsizeNote :: FilePath -> Integer -> Integer -> String
|
||||
badsizeNote dest expected got = "Bad file size (" ++ aside ++ "); moved to " ++ dest
|
||||
where
|
||||
expected' = roughSize True expected
|
||||
got' = roughSize True got
|
||||
aside =
|
||||
if expected' == got'
|
||||
then show got ++ " not " ++ show expected
|
||||
else got' ++ " not " ++ expected'
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module DataUnits (roughSize) where
|
||||
module DataUnits (roughSize, compareSizes) where
|
||||
|
||||
{- And now a rant:
|
||||
-
|
||||
|
@ -63,3 +63,9 @@ roughSize short i
|
|||
plural n u
|
||||
| n == 1 = u
|
||||
| otherwise = u ++ "s"
|
||||
|
||||
compareSizes :: Bool -> Integer -> Integer -> String
|
||||
compareSizes short old new
|
||||
| old > new = roughSize short (old - new) ++ " smaller"
|
||||
| old < new = roughSize short (new - old) ++ " larger"
|
||||
| otherwise = "same"
|
||||
|
|
Loading…
Reference in a new issue