svn commit: r460620 - in head/games/keeperrl: . files
Pawel Pekala
pawel at FreeBSD.org
Thu Feb 1 17:31:37 UTC 2018
Author: pawel
Date: Thu Feb 1 17:31:35 2018
New Revision: 460620
URL: https://svnweb.freebsd.org/changeset/ports/460620
Log:
Add patch that forces configuration files in $H/.KeeperRL directory
instead of current working directory
Added:
head/games/keeperrl/files/
head/games/keeperrl/files/patch-main.cpp (contents, props changed)
Modified:
head/games/keeperrl/Makefile
Modified: head/games/keeperrl/Makefile
==============================================================================
--- head/games/keeperrl/Makefile Thu Feb 1 17:29:09 2018 (r460619)
+++ head/games/keeperrl/Makefile Thu Feb 1 17:31:35 2018 (r460620)
@@ -2,6 +2,7 @@
PORTNAME= keeperrl
PORTVERSION= 0.0.${ALPHA_VERSION}
+PORTREVISION= 1
CATEGORIES= games
MAINTAINER= pawel at FreeBSD.org
Added: head/games/keeperrl/files/patch-main.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/keeperrl/files/patch-main.cpp Thu Feb 1 17:31:35 2018 (r460620)
@@ -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());
More information about the svn-ports-all
mailing list