diff options
author | pawel <pawel@FreeBSD.org> | 2018-02-02 01:31:35 +0800 |
---|---|---|
committer | Koop Mast <kwm@rainbow-runner.nl> | 2018-02-04 06:33:11 +0800 |
commit | 9953f488201cb86d1bda1236ce8712f8680ed71a (patch) | |
tree | 17ea79da912fab18f987fc99b78205024ab4b441 | |
parent | 314498bd516f5087149d957684dd46e77565c0cc (diff) | |
download | freebsd-ports-gnome-9953f488201cb86d1bda1236ce8712f8680ed71a.tar.gz freebsd-ports-gnome-9953f488201cb86d1bda1236ce8712f8680ed71a.tar.zst freebsd-ports-gnome-9953f488201cb86d1bda1236ce8712f8680ed71a.zip |
Add patch that forces configuration files in $H/.KeeperRL directory
instead of current working directory
-rw-r--r-- | games/keeperrl/Makefile | 1 | ||||
-rw-r--r-- | games/keeperrl/files/patch-main.cpp | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/games/keeperrl/Makefile b/games/keeperrl/Makefile index 8835e8d49aff..91b329b65e05 100644 --- a/games/keeperrl/Makefile +++ b/games/keeperrl/Makefile @@ -2,6 +2,7 @@ PORTNAME= keeperrl PORTVERSION= 0.0.${ALPHA_VERSION} +PORTREVISION= 1 CATEGORIES= games MAINTAINER= pawel@FreeBSD.org diff --git a/games/keeperrl/files/patch-main.cpp b/games/keeperrl/files/patch-main.cpp new file mode 100644 index 000000000000..cc3ca4a0157f --- /dev/null +++ b/games/keeperrl/files/patch-main.cpp @@ -0,0 +1,43 @@ +--- main.cpp.orig 2018-01-31 20:31:47 UTC ++++ main.cpp +@@ -22,6 +22,7 @@ + #include "extern/ProgramOptions.h" + + #include <exception> ++#include <sys/stat.h> + + #include "view.h" + #include "options.h" +@@ -285,18 +286,8 @@ static int keeperMain(po::parser& commandLineFlags) { + DirectoryPath userPath([&] () -> string { + if (commandLineFlags["user_dir"].was_set()) + return commandLineFlags["user_dir"].get().string; +-#ifdef USER_DIR +- else if (const char* userDir = USER_DIR) +- return userDir; +-#endif // USER_DIR +-#ifndef WINDOWS +- else if (const char* localPath = std::getenv("XDG_DATA_HOME")) +- return localPath + string("/KeeperRL"); +-#endif +-#ifdef ENABLE_LOCAL_USER_DIR // Some environments don't define XDG_DATA_HOME + else if (const char* homePath = std::getenv("HOME")) +- return homePath + string("/.local/share/KeeperRL"); +-#endif // ENABLE_LOCAL_USER_DIR ++ return homePath + string("/.KeeperRL"); + else + return "."; + }()); +@@ -311,8 +302,10 @@ static int keeperMain(po::parser& commandLineFlags) { + #else + uploadUrl = "http://localhost/~michal/" + serverVersion; + #endif +- //userPath.createIfDoesntExist(); +- CHECK(userPath.exists()) << "User directory \"" << userPath << "\" doesn't exist."; ++ if (!userPath.exists()) { ++ auto configDir = userPath.file(""); ++ ::mkdir(configDir.getPath(), 0775); ++ } + auto settingsPath = userPath.file("options.txt"); + if (commandLineFlags["restore_settings"].was_set()) + remove(settingsPath.getPath()); |