diff options
author | aszlig <aszlig@nix.build> | 2019-06-21 04:37:37 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2019-06-21 04:46:28 +0200 |
commit | b5f22e1874786bf0641bc0cfe1f6c2eedf0ff649 (patch) | |
tree | 3cd7618f4f16888d4d2424dc924a20ddd4276820 /pkgs/games/gog/warcraft2/xdg.patch | |
parent | f33d5617c08f8378433d00f18e9f0bb7136ca5ad (diff) |
pkgs/games: Add Warcraft II BNE
This is supported by the Stratagus/Wargus engine and it's using the data files from the GOG version. I had this laying in the repository for a while but didn't commit and push it yet, so let's call it done by now :-) Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/games/gog/warcraft2/xdg.patch')
-rw-r--r-- | pkgs/games/gog/warcraft2/xdg.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/games/gog/warcraft2/xdg.patch b/pkgs/games/gog/warcraft2/xdg.patch new file mode 100644 index 00000000..979a86e3 --- /dev/null +++ b/pkgs/games/gog/warcraft2/xdg.patch @@ -0,0 +1,37 @@ +diff --git a/src/stratagus/parameters.cpp b/src/stratagus/parameters.cpp +index a705ba21d..8585856b0 100644 +--- a/src/stratagus/parameters.cpp ++++ b/src/stratagus/parameters.cpp +@@ -48,26 +48,13 @@ void Parameters::SetDefaultValues() + + void Parameters::SetDefaultUserDirectory() + { +-#ifdef USE_GAME_DIR +- userDirectory = StratagusLibPath; +-#elif USE_WIN32 +- userDirectory = getenv("APPDATA"); +-#else +- userDirectory = getenv("HOME"); +-#endif +- +- if (!userDirectory.empty()) { +- userDirectory += "/"; ++ const char *xdg_data_home = getenv("XDG_DATA_HOME"); ++ if (xdg_data_home == NULL) { ++ userDirectory = getenv("HOME"); ++ userDirectory += "/.local/share"; ++ } else { ++ userDirectory = xdg_data_home; + } +- +-#ifdef USE_GAME_DIR +-#elif USE_WIN32 +- userDirectory += "Stratagus"; +-#elif defined(USE_MAC) +- userDirectory += "Library/Stratagus"; +-#else +- userDirectory += ".stratagus"; +-#endif + } + + static std::string GetLocalPlayerNameFromEnv() |