diff options
Diffstat (limited to 'games-strategy/wesnoth/files/wesnoth-1.10-xdg-path-fix.patch')
-rw-r--r-- | games-strategy/wesnoth/files/wesnoth-1.10-xdg-path-fix.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/games-strategy/wesnoth/files/wesnoth-1.10-xdg-path-fix.patch b/games-strategy/wesnoth/files/wesnoth-1.10-xdg-path-fix.patch new file mode 100644 index 000000000000..965195a5c699 --- /dev/null +++ b/games-strategy/wesnoth/files/wesnoth-1.10-xdg-path-fix.patch @@ -0,0 +1,54 @@ +Index: src/filesystem.cpp +=================================================================== +--- src/filesystem.cpp (Revision 52751) ++++ src/filesystem.cpp (Revision 52752) +@@ -63,6 +63,7 @@ + #include "loadscreen.hpp" + #include "scoped_resource.hpp" + #include "serialization/string_utils.hpp" ++#include "version.hpp" + + static lg::log_domain log_filesystem("filesystem"); + #define DBG_FS LOG_STREAM(debug, log_filesystem) +@@ -501,6 +502,23 @@ + + static void setup_user_data_dir(); + ++static const std::string& get_version_path_suffix() ++{ ++ static std::string suffix; ++ ++ // We only really need to generate this once since ++ // the version number cannot change during runtime. ++ ++ if(suffix.empty()) { ++ std::ostringstream s; ++ s << game_config::wesnoth_version.major_version() << '.' ++ << game_config::wesnoth_version.minor_version(); ++ suffix = s.str(); ++ } ++ ++ return suffix; ++} ++ + void set_preferences_dir(std::string path) + { + #ifdef _WIN32 +@@ -537,7 +555,7 @@ + if (path.empty()) path = PREFERENCES_DIR; + #endif + +- std::string path2 = ".wesnoth" + game_config::version.substr(0,3); ++ std::string path2 = ".wesnoth" + get_version_path_suffix(); + + #ifdef _X11 + const char *home_str = getenv("HOME"); +@@ -553,7 +571,7 @@ + user_data_dir += "/.local/share"; + } else user_data_dir = xdg_data; + user_data_dir += "/wesnoth/"; +- user_data_dir += game_config::version.substr(0,3); ++ user_data_dir += get_version_path_suffix(); + create_directory_if_missing_recursive(user_data_dir); + game_config::preferences_dir = user_data_dir; + } else { |