Fix deprecation warning being printed when compiling with -DPREFERENCES_DIR=\".wesnoth-1.15\".

This commit is contained in:
josteph 2019-10-24 04:36:02 +00:00
parent 2125a9e779
commit f2de9621fa
2 changed files with 27 additions and 10 deletions

View file

@ -1,4 +1,15 @@
## Version 1.15.2+dev
### AI:
### Campaigns
### Editor
### Language and i18n
### Terrains
### User interface
### Lua API
### WML engine
### Miscellaneous and bug fixes
* Fix --userdata-dir deprecation warning being printed when starting wesnoth without arguments
when -DPREFERENCES_DIR="..." was defined at compile time.
## Version 1.15.2
### AI:

View file

@ -605,9 +605,11 @@ static bool is_path_relative_to_cwd(const std::string& str)
void set_user_data_dir(std::string newprefdir)
{
bool relative_ok = false;
#ifdef PREFERENCES_DIR
if(newprefdir.empty()) {
newprefdir = PREFERENCES_DIR;
relative_ok = true;
}
#endif
@ -693,11 +695,13 @@ void set_user_data_dir(std::string newprefdir)
if(newprefdir[0] == '/') {
user_data_dir = newprefdir;
} else {
// TRANSLATORS: translate the part inside <...> only
deprecated_message(_("--userdata-dir=<relative path>"),
DEP_LEVEL::FOR_REMOVAL,
{1, 17, 0},
_("Use absolute paths. Relative paths are deprecated because they are interpreted relative to $HOME"));
if(!relative_ok) {
// TRANSLATORS: translate the part inside <...> only
deprecated_message(_("--userdata-dir=<relative path>"),
DEP_LEVEL::FOR_REMOVAL,
{1, 17, 0},
_("Use absolute paths. Relative paths are deprecated because they are interpreted relative to $HOME"));
}
user_data_dir = home / newprefdir;
}
}
@ -712,11 +716,13 @@ void set_user_data_dir(std::string newprefdir)
if(newprefdir[0] == '/') {
user_data_dir = newprefdir;
} else {
// TRANSLATORS: translate the part inside <...> only
deprecated_message(_("--userdata-dir=<relative path>"),
DEP_LEVEL::FOR_REMOVAL,
{1, 17, 0},
_("Use absolute paths. Relative paths are deprecated because they are interpreted relative to $HOME"));
if(!relative_ok) {
// TRANSLATORS: translate the part inside <...> only
deprecated_message(_("--userdata-dir=<relative path>"),
DEP_LEVEL::FOR_REMOVAL,
{1, 17, 0},
_("Use absolute paths. Relative paths are deprecated because they are interpreted relative to $HOME"));
}
user_data_dir = home / newprefdir;
}
#endif