GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1509172-map-saving-paths into lp:widelands.
Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1509172 in widelands: "editor gives error on saving maps" https://bugs.launchpad.net/widelands/+bug/1509172 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1509172-map-saving-paths/+merge/286067 I hope that this will fix the map saving bug in Windows. I can reproduce the original bug, but I need the AppVeyor build to check if this fixes it. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1509172-map-saving-paths into lp:widelands.
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc' --- src/editor/ui_menus/editor_main_menu_save_map.cc 2016-01-31 10:57:58 +0000 +++ src/editor/ui_menus/editor_main_menu_save_map.cc 2016-02-15 14:56:39 +0000 @@ -126,7 +126,7 @@ if (filename == "" && table_.has_selection()) { // Maybe a directory is selected. complete_filename = filename = maps_data_[table_.get_selected()].filename; } else { - complete_filename = curdir_ + "/" + filename; + complete_filename = curdir_ + g_fs->file_separator() + filename; } if (g_fs->is_directory(complete_filename.c_str()) && @@ -155,9 +155,7 @@ if (md.run<UI::Panel::Returncodes>() == UI::Panel::Returncodes::kOk) { g_fs->ensure_directory_exists(curdir_); // create directory - std::string fullname = curdir_; - fullname += "/"; - fullname += md.get_dirname(); + std::string fullname = curdir_ + g_fs->file_separator() + md.get_dirname(); g_fs->make_directory(fullname); fill_table(); } @@ -227,16 +225,15 @@ */ bool MainMenuSaveMap::save_map(std::string filename, bool binary) { // Make sure that the current directory exists and is writeable. - g_fs->ensure_directory_exists(curdir_); + const std::string current_dir = g_fs->canonicalize_name(curdir_); + g_fs->ensure_directory_exists(current_dir); // OK, first check if the extension matches (ignoring case). if (!boost::iends_with(filename, WLMF_SUFFIX)) filename += WLMF_SUFFIX; // append directory name - std::string complete_filename = curdir_; - complete_filename += "/"; - complete_filename += filename; + std::string complete_filename = current_dir + g_fs->file_separator() + filename; // Check if file exists. If so, show a warning. if (g_fs->file_exists(complete_filename)) { === modified file 'src/graphic/animation.cc' --- src/graphic/animation.cc 2016-02-09 08:07:48 +0000 +++ src/graphic/animation.cc 2016-02-15 14:56:39 +0000 @@ -114,7 +114,7 @@ const std::string name = sound_effects->get_string("name"); const std::string directory = sound_effects->get_string("directory"); - sound_effect_ = directory + "/" + name; + sound_effect_ = directory + g_fs->file_separator() + name; g_sound_handler.load_fx_if_needed(directory, name, sound_effect_); } === modified file 'src/logic/map_objects/tribes/production_program.cc' --- src/logic/map_objects/tribes/production_program.cc 2016-02-09 08:07:48 +0000 +++ src/logic/map_objects/tribes/production_program.cc 2016-02-15 14:56:39 +0000 @@ -1524,7 +1524,7 @@ bool reached_end; const std::string& filepath = next_word(parameters, reached_end); const std::string& filename = next_word(parameters, reached_end); - name = filepath + "/" + filename; + name = filepath + g_fs->file_separator() + filename; if (!reached_end) { char * endp; === modified file 'src/logic/save_handler.cc' --- src/logic/save_handler.cc 2015-11-14 15:58:29 +0000 +++ src/logic/save_handler.cc 2016-02-15 14:56:39 +0000 @@ -167,9 +167,7 @@ filename += WLGF_SUFFIX; // Now append directory name - std::string complete_filename = dir; - complete_filename += "/"; - complete_filename += filename; + std::string complete_filename = dir + g_fs->file_separator() + filename; return complete_filename; }
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp