summaryrefslogtreecommitdiff
path: root/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch
diff options
context:
space:
mode:
Diffstat (limited to 'games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch')
-rw-r--r--games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch
new file mode 100644
index 00000000..df26fcd5
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch
@@ -0,0 +1,66 @@
+compile-time configurable paths
+
+From: eroen <eroen@occam.eroen.eu>
+
+hack/
+./
+---
+ library/Core.cpp | 12 ++++++++++++
+ plugins/zone.cpp | 2 ++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/library/Core.cpp b/library/Core.cpp
+index 617ea42..128fc46 100644
+--- a/library/Core.cpp
++++ b/library/Core.cpp
+@@ -322,7 +322,11 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr,
+ rbcmd += "'" + args[i] + "', ";
+ rbcmd += "]\n";
+
++#ifdef DFHACK_DATA_DESTINATION
++ rbcmd += "catch(:script_finished) { load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb' }";
++#else
+ rbcmd += "catch(:script_finished) { load './hack/scripts/" + name + ".rb' }";
++#endif
+
+ return plug_mgr->ruby->eval_ruby(out, rbcmd.c_str());
+ }
+@@ -410,7 +414,11 @@ string findScript(string path, string name) {
+ if (fileExists(file)) {
+ return file;
+ }
++ #ifdef DFHACK_DATA_DESTINATION
++ file = string(DFHACK_DATA_DESTINATION) + "/scripts/" + name;
++ #else
+ file = path + "/hack/scripts/" + name;
++ #endif
+ if (fileExists(file)) {
+ return file;
+ }
+@@ -971,7 +979,11 @@ void Core::fatal (std::string output, bool deactivate)
+ std::string Core::getHackPath()
+ {
+ #ifdef LINUX_BUILD
++ #ifdef DFHACK_DATA_DESTINATION
++ return DFHACK_DATA_DESTINATION "/";
++ #else
+ return p->getPath() + "/hack/";
++ #endif
+ #else
+ return p->getPath() + "\\hack\\";
+ #endif
+diff --git a/plugins/zone.cpp b/plugins/zone.cpp
+index 5690ec2..b10d9d8 100644
+--- a/plugins/zone.cpp
++++ b/plugins/zone.cpp
+@@ -3182,8 +3182,10 @@ command_result df_autobutcher(color_ostream &out, vector <string> & parameters)
+ {
+ string run = "dfhack-run autobutcher ";
+ #ifdef LINUX_BUILD
++#ifndef DFHACK_DATA_DESTINATION
+ run = "./dfhack-run autobutcher ";
+ #endif
++#endif
+ // force creation of config
+ out << run << "start" << endl;
+