Skip to content

Commit

Permalink
GUI2/Screenshot Notification: fixed wrong path being used for opening…
Browse files Browse the repository at this point in the history
… screenshot (fixes #5322)
  • Loading branch information
Vultraz committed Dec 19, 2020
1 parent 3118f34 commit 92c10f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Expand Up @@ -36,6 +36,8 @@
* Add a overwrite_specials option for abilities like weapon could overwrite specials or other ablities like weapon
### Miscellaneous and Bug Fixes
* Fixed several possible crashes in wmllint
* Screenshots now default to JPG instead of PNG
* Fixed screenshot popup sometimes using the wrong path when trying to open the screenshot after saving

## Version 1.15.7
### Add-ons server
Expand Down
4 changes: 3 additions & 1 deletion src/gui/dialogs/screenshot_notification.cpp
Expand Up @@ -125,6 +125,8 @@ void screenshot_notification::save_screenshot()
boost::filesystem::path path(screenshots_dir_path_);
path /= filename;

path_ = path.string();

image::save_result res = image::save_image(screenshot_, path.string());
if(res == image::save_result::unsupported_format) {
gui2::show_error_message(_("Unsupported image format.\n\n"
Expand All @@ -144,7 +146,7 @@ void screenshot_notification::save_screenshot()
find_widget<button>(&window, "copy", false).set_active(true);
}

const int filesize = filesystem::file_size(path.string());
const int filesize = filesystem::file_size(path_);
const std::string sizetext = utils::si_string(filesize, true, _("unit_byte^B"));
find_widget<label>(&window, "filesize", false).set_label(sizetext);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/screenshot_notification.hpp
Expand Up @@ -41,7 +41,7 @@ class screenshot_notification : public modal_dialog
DEFINE_SIMPLE_DISPLAY_WRAPPER(screenshot_notification)

private:
const std::string path_;
std::string path_;
const std::string screenshots_dir_path_;
surface screenshot_;

Expand Down

0 comments on commit 92c10f1

Please sign in to comment.