widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #13735
Re: [Merge] lp:~lucki1/widelands/add-xdg-support into lp:widelands
Lucki: On a normal build this will never be enabled.
e.g. I use compile.sh which does not know about that flag, yet.
I will compile this on OSX now.
Once with default and once with -DUSE_XDG=ON
It shoud not make any difference though.
As of the code this will only come into effect for completely new installations,
as long as there is a ~/.widelands directory this still will be used.
Diff comments:
>
> === modified file 'src/io/filesystem/filesystem.cc'
> --- src/io/filesystem/filesystem.cc 2018-06-06 19:45:06 +0000
> +++ src/io/filesystem/filesystem.cc 2018-06-16 19:42:51 +0000
> @@ -262,6 +262,51 @@
> return homedir;
> }
>
> +std::string FileSystem::get_xdgdir() {
> + std::string xdgdir;
> +#ifdef HAS_GETENV
> + if (char const* const h = getenv("HOME")) {
> + if (char const* const x = getenv("XDG_DATA_HOME")) {
> + xdgdir = x;
> +
> + // Unlike the other function, this function returns the program name
> + // with. This is handled in 'src/wlapplication.cc'.
> + xdgdir = xdgdir + "/widelands";
> + }
> + else {
> + // If XDG_DATA_HOME is not set, the default path is used.
> + xdgdir = h;
> + xdgdir = xdgdir + "/.local/share";
> +
> + // Unlike the other function, this function returns the program name
> + // with. This is handled in 'src/wlapplication.cc'.
> + xdgdir = xdgdir + "/widelands";
> + }
> +
> + // Use dotfolder for backwards compatibility if it exists.
> + RealFSImpl dot(h);
> + if (dot.is_directory(".widelands")) {
> + xdgdir = h;
> +
> + // Unlike the other function, this function returns the program name
> + // with. This is handled in 'src/wlapplication.cc'.
> + xdgdir = xdgdir + "/.widelands";
> + }
> + }
> +#endif
> +
> + if (xdgdir.empty()) {
> + log("\nWARNING: either we can not detect your XDG or home directory "
> + "or you do not have one! Please contact the developers.\n\n");
> +
> + // TODO(Luki): is it really a good idea to set xdgdir to "." then ??
> + log("Instead of your XDG or home directory, '.' will be used.\n\n");
> + xdgdir = "./.widelands";
Uhhm, this should be ~/.widelands, or $HOME/.widelands? Not sure when we hit this.
This contradicts your commit message.
> + }
> +
> + return xdgdir;
> +}
> +
> /**
> * Split a string into components separated by a certain character.
> *
--
https://code.launchpad.net/~lucki1/widelands/add-xdg-support/+merge/347652
Your team Widelands Developers is requested to review the proposed merge of lp:~lucki1/widelands/add-xdg-support into lp:widelands.
References