gui2/tgame_cache_options: Handle negative values from filesystem::dir_size()
The Boost.filesystem version of this function yields a negative value of -1 to signify a non-critical error. For some reason, utils::si_string() formats this incorrectly and even yields an incorrect number, probably due to some floating point math mess-up. Kind of fixes bug #22261 by preventing a call to utils::si_string() with a negative value, but that function really ought to be fixed separately anyway.
This commit is contained in:
parent
cd022369aa
commit
b79df59e08
1 changed files with 7 additions and 3 deletions
|
@ -126,9 +126,13 @@ void tgame_cache_options::update_cache_size_display()
|
|||
return;
|
||||
}
|
||||
|
||||
size_label_->set_label(utils::si_string(filesystem::dir_size(cache_path_),
|
||||
true,
|
||||
_("unit_byte^B")));
|
||||
const int size = filesystem::dir_size(cache_path_);
|
||||
|
||||
if(size < 0) {
|
||||
size_label_->set_label(_("dir_size^Unknown"));
|
||||
} else {
|
||||
size_label_->set_label(utils::si_string(size, true, _("unit_byte^B")));
|
||||
}
|
||||
}
|
||||
|
||||
void tgame_cache_options::copy_to_clipboard_callback()
|
||||
|
|
Loading…
Add table
Reference in a new issue