fs: Default to Documents for user config/data on Windows
Use Documents\My Games\WesnothX.Y for user config data on Windows like we currently do when using --config-dir there with a relative path. The behavior of --config-dir when passed a relative path remains unchanged with this commit, making the new out-of-the-box default equivalent to passing --config-dir WesnothX.Y, except this is now enforced by Wesnoth rather than a finicky installer option. See bug #23753 for the rationale behind this change. People who really can't live without the old CWD\userdata layout should either use --config-dir with an absolute path to their existing userdata dir, or wait for the next commit (which will help with "portable" installs to removable devices, for example).
This commit is contained in:
parent
1fe5134e73
commit
795dd8c420
1 changed files with 5 additions and 5 deletions
|
@ -444,7 +444,6 @@ std::string get_next_filename(const std::string& name, const std::string& extens
|
||||||
|
|
||||||
static path user_data_dir, user_config_dir, cache_dir;
|
static path user_data_dir, user_config_dir, cache_dir;
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
static const std::string& get_version_path_suffix()
|
static const std::string& get_version_path_suffix()
|
||||||
{
|
{
|
||||||
static std::string suffix;
|
static std::string suffix;
|
||||||
|
@ -461,7 +460,6 @@ static const std::string& get_version_path_suffix()
|
||||||
|
|
||||||
return suffix;
|
return suffix;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void setup_user_data_dir()
|
static void setup_user_data_dir()
|
||||||
{
|
{
|
||||||
|
@ -483,12 +481,14 @@ static void setup_user_data_dir()
|
||||||
void set_user_data_dir(std::string newprefdir)
|
void set_user_data_dir(std::string newprefdir)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if(newprefdir.empty()) {
|
if(newprefdir.size() > 2 && newprefdir[1] == ':') {
|
||||||
user_data_dir = get_cwd() + "/userdata";
|
|
||||||
} else if(newprefdir.size() > 2 && newprefdir[1] == ':') {
|
|
||||||
//allow absolute path override
|
//allow absolute path override
|
||||||
user_data_dir = newprefdir;
|
user_data_dir = newprefdir;
|
||||||
} else {
|
} else {
|
||||||
|
if(newprefdir.empty()) {
|
||||||
|
newprefdir = "Wesnoth" + get_version_path_suffix();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: we no longer need to use LoadLibrary since versions <
|
// TODO: we no longer need to use LoadLibrary since versions <
|
||||||
// Windows XP are no longer supported so the required
|
// Windows XP are no longer supported so the required
|
||||||
|
|
Loading…
Add table
Reference in a new issue