From 269bc98711fdb38cf7647dcc90bbe49f703bf5b3 Mon Sep 17 00:00:00 2001 From: crosire Date: Sun, 10 Jul 2022 21:14:06 +0200 Subject: [PATCH] Change default screenshot path to a relative path --- source/runtime.cpp | 18 +++++------------- source/runtime_gui.cpp | 4 ---- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/source/runtime.cpp b/source/runtime.cpp index d3e05cfe6a..ac154f3868 100644 --- a/source/runtime.cpp +++ b/source/runtime.cpp @@ -171,10 +171,10 @@ reshade::runtime::runtime(api::device *device, api::command_queue *graphics_queu _texture_search_paths({ L".\\" }), #endif _config_path(g_reshade_base_path / L"ReShade.ini"), - _screenshot_path(g_reshade_base_path), + _screenshot_path(L".\\"), _screenshot_name("%AppName% %Date% %Time%"), _screenshot_post_save_command_arguments("\"%TargetPath%\""), - _screenshot_post_save_command_working_directory(g_reshade_base_path) + _screenshot_post_save_command_working_directory(L".\\") { assert(device != nullptr && graphics_queue != nullptr); @@ -4307,21 +4307,13 @@ bool reshade::runtime::execute_screenshot_post_save_command(const std::filesyste }); } - std::filesystem::path working_directory; - if (_screenshot_post_save_command_working_directory.empty() || !std::filesystem::is_directory(_screenshot_post_save_command_working_directory, ec)) - working_directory = g_reshade_base_path; - else - working_directory = _screenshot_post_save_command_working_directory; - - if (execute_command(command_line, working_directory, _screenshot_post_save_command_no_window)) - { - return true; - } - else + if (!execute_command(command_line, g_reshade_base_path / _screenshot_post_save_command_working_directory, _screenshot_post_save_command_no_window)) { LOG(ERROR) << "Failed to execute screenshot post-save command."; return false; } + + return true; } bool reshade::runtime::get_texture_data(api::resource resource, api::resource_usage state, uint8_t *pixels) diff --git a/source/runtime_gui.cpp b/source/runtime_gui.cpp index 0f5d9ac852..dccfc2f6af 100644 --- a/source/runtime_gui.cpp +++ b/source/runtime_gui.cpp @@ -2334,10 +2334,7 @@ void reshade::runtime::draw_gui_addons() std::filesystem::path addon_search_path = g_reshade_base_path; global_config().get("INSTALL", "AddonPath", addon_search_path); if (imgui::directory_input_box("Add-on search path", addon_search_path, _file_selection_path)) - { global_config().set("INSTALL", "AddonPath", addon_search_path); - global_config().save(); - } #endif ImGui::Spacing(); @@ -2380,7 +2377,6 @@ void reshade::runtime::draw_gui_addons() disabled_addons.push_back(info.name); global_config().set("ADDON", "DisabledAddons", disabled_addons); - global_config().save(); } ImGui::PopStyleColor();