diff options
Diffstat (limited to 'ranger/ext/human_readable.py')
-rw-r--r-- | ranger/ext/human_readable.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py index f365e594..385e56f4 100644 --- a/ranger/ext/human_readable.py +++ b/ranger/ext/human_readable.py @@ -3,6 +3,8 @@ from __future__ import (absolute_import, division, print_function) +from ranger.core.shared import SettingsAware + def human_readable(byte, separator=' '): # pylint: disable=too-many-return-statements """Convert a large number of bytes to an easily readable format. @@ -19,6 +21,9 @@ def human_readable(byte, separator=' '): # pylint: disable=too-many-return-stat if byte is None: return '' + if SettingsAware.settings.size_in_bytes: + return format(byte, 'n') # 'n' = locale-aware separator. + # I know this can be written much shorter, but this long version # performs much better than what I had before. If you attempt to # shorten this code, take performance into consideration. |