Skip to content

Commit

Permalink
fs: Default to Documents for user config/data on Windows
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
irydacea committed Oct 20, 2015
1 parent 1fe5134 commit 795dd8c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/filesystem_boost.cpp
Expand Up @@ -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;

#ifndef _WIN32
static const std::string& get_version_path_suffix()
{
static std::string suffix;
Expand All @@ -461,7 +460,6 @@ static const std::string& get_version_path_suffix()

return suffix;
}
#endif

static void setup_user_data_dir()
{
Expand All @@ -483,12 +481,14 @@ static void setup_user_data_dir()
void set_user_data_dir(std::string newprefdir)
{
#ifdef _WIN32
if(newprefdir.empty()) {
user_data_dir = get_cwd() + "/userdata";
} else if(newprefdir.size() > 2 && newprefdir[1] == ':') {
if(newprefdir.size() > 2 && newprefdir[1] == ':') {
//allow absolute path override
user_data_dir = newprefdir;
} else {
if(newprefdir.empty()) {
newprefdir = "Wesnoth" + get_version_path_suffix();
}

//
// TODO: we no longer need to use LoadLibrary since versions <
// Windows XP are no longer supported so the required
Expand Down

0 comments on commit 795dd8c

Please sign in to comment.