open load map/save map as dialogs in the addon's map directory

with no addon selected they open in the editor/maps directory
This commit is contained in:
Subhraman Sarkar 2024-07-05 09:45:50 +05:30
parent bf85b31c59
commit 88fc3cda4f

View file

@ -210,7 +210,11 @@ void context_manager::load_map_dialog(bool force_same_context /* = false */)
{ {
std::string fn = get_map_context().get_filename(); std::string fn = get_map_context().get_filename();
if(fn.empty()) { if(fn.empty()) {
fn = filesystem::get_legacy_editor_dir()+"/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; 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(); std::string input_name = get_map_context().get_filename();
if(input_name.empty()) { if(input_name.empty()) {
first_pick = true; 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; gui2::dialogs::file_dialog dlg;