use the correct editor dir location

fixes issue brought up on the forums: https://forums.wesnoth.org/viewtopic.php?t=58725
This commit is contained in:
pentarctagon 2024-09-25 23:58:38 -05:00 committed by Pentarctagon
parent 1d9f57a668
commit 82c7b4c7eb
3 changed files with 7 additions and 8 deletions

View file

@ -304,7 +304,7 @@ std::string read_map(const std::string& name)
}
if(res.empty()) {
res = read_file(get_user_data_dir() + "/editor/maps/" + name);
res = read_file(get_legacy_editor_dir() + "/maps/" + name);
}
return res;
@ -323,7 +323,7 @@ std::string read_scenario(const std::string& name)
}
if(res.empty()) {
res = read_file(get_user_data_dir() + "/editor/scenarios/" + name);
res = read_file(get_legacy_editor_dir() + "/scenarios/" + name);
}
return res;

View file

@ -265,10 +265,10 @@ create_engine::create_engine(saved_game& state)
dependency_manager_.reset(new depcheck::manager(game_config_, state_.classification().is_multiplayer()));
// TODO: the editor dir is already configurable, is the preferences value
filesystem::get_files_in_dir(filesystem::get_user_data_dir() + "/editor/maps", &user_map_names_,
filesystem::get_files_in_dir(filesystem::get_legacy_editor_dir() + "/maps", &user_map_names_,
nullptr, filesystem::name_mode::FILE_NAME_ONLY);
filesystem::get_files_in_dir(filesystem::get_user_data_dir() + "/editor/scenarios", &user_scenario_names_,
filesystem::get_files_in_dir(filesystem::get_legacy_editor_dir() + "/scenarios", &user_scenario_names_,
nullptr, filesystem::name_mode::FILE_NAME_ONLY);
DBG_MP << "initializing all levels, eras and mods";
@ -687,10 +687,10 @@ void create_engine::init_all_levels()
{
config data;
try {
read(data, *preprocess_file(filesystem::get_user_data_dir() + "/editor/scenarios/" + user_scenario_names_[i]));
read(data, *preprocess_file(filesystem::get_legacy_editor_dir() + "/scenarios/" + user_scenario_names_[i]));
} catch(const config::error & e) {
ERR_CF << "Caught a config error while parsing user made (editor) scenarios:\n" << e.message;
ERR_CF << "Skipping file: " << (filesystem::get_user_data_dir() + "/editor/scenarios/" + user_scenario_names_[i]);
ERR_CF << "Skipping file: " << (filesystem::get_legacy_editor_dir() + "/scenarios/" + user_scenario_names_[i]);
continue;
}

View file

@ -149,8 +149,7 @@ void menu_handler::status_table()
void menu_handler::save_map()
{
const std::string& input_name
= filesystem::get_dir(filesystem::get_dir(filesystem::get_user_data_dir() + "/editor") + "/maps/");
const std::string input_name = filesystem::get_legacy_editor_dir() + "/maps/";
gui2::dialogs::file_dialog dlg;