From 9953f488201cb86d1bda1236ce8712f8680ed71a Mon Sep 17 00:00:00 2001 From: pawel Date: Thu, 1 Feb 2018 17:31:35 +0000 Subject: Add patch that forces configuration files in $H/.KeeperRL directory instead of current working directory --- games/keeperrl/Makefile | 1 + games/keeperrl/files/patch-main.cpp | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 games/keeperrl/files/patch-main.cpp 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 ++#include + + #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()); -- cgit