Check log file actually exists before enabling Log File button (#8727)

* Check log file actually exists before enabling Log File button. Resolves #8691.

* Return empty string if output file path is empty.
This commit is contained in:
Wedge009 2024-04-14 16:56:01 +10:00 committed by GitHub
parent eb8fe63928
commit c62fd51f48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -141,7 +141,7 @@ void game_version::pre_show(window& window)
button& stderr_button = find_widget<button>(&window, "open_stderr", false);
connect_signal_mouse_left_click(stderr_button, std::bind(&game_version::browse_directory_callback, this, log_path_));
stderr_button.set_active(!log_path_.empty());
stderr_button.set_active(!log_path_.empty() && filesystem::file_exists(log_path_));
//
// Build info tab.

View file

@ -279,7 +279,7 @@ std::optional<bool> log_dir_writable()
std::string get_log_file_path()
{
return output_file_path_+lg::log_file_suffix;
return output_file_path_.empty() ? "" : output_file_path_+lg::log_file_suffix;
}
redirect_output_setter::redirect_output_setter(std::ostream& stream)