open load map/save map as dialog in correct folders (#9129)

Opens load map/save map as dialogs in the addon's map directory if an addon is selected.
With no addon selected they open in the editor/maps directory.
This commit is contained in:
Subhraman Sarkar 2024-07-25 14:35:22 +05:30 committed by GitHub
parent d47466dfc0
commit ebe4ee9d09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -208,7 +208,11 @@ void context_manager::load_map_dialog(bool force_same_context /* = false */)
{
std::string fn = get_map_context().get_filename();
if(fn.empty()) {
fn = filesystem::get_current_editor_dir(current_addon_) +"/maps";
if (editor_controller::current_addon_id_.empty()) {
fn = filesystem::get_legacy_editor_dir() + "/maps";
} else {
fn = filesystem::get_current_editor_dir(editor_controller::current_addon_id_) + "/maps";
}
}
gui2::dialogs::file_dialog dlg;
@ -680,7 +684,11 @@ void context_manager::save_map_as_dialog()
std::string input_name = get_map_context().get_filename();
if(input_name.empty()) {
first_pick = true;
input_name = filesystem::get_current_editor_dir(editor_controller::current_addon_id_)+"/maps";
if (editor_controller::current_addon_id_.empty()) {
input_name = filesystem::get_legacy_editor_dir() + "/maps";
} else {
input_name = filesystem::get_current_editor_dir(editor_controller::current_addon_id_) + "/maps";
}
}
gui2::dialogs::file_dialog dlg;