From 08656a3ca7d433c43e052920836e650880c18b90 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 8 Aug 2017 20:08:07 -0400 Subject: [PATCH] Strip DF folder from Ruby script paths Fixes #1146 (temporarily, see #1147) --- library/Core.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/Core.cpp b/library/Core.cpp index fccf7f464..62d605fe6 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -388,6 +388,15 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, if (!plug_mgr->ruby || !plug_mgr->ruby->is_enabled()) return CR_FAILURE; + // ugly temporary patch for https://github.com/DFHack/dfhack/issues/1146 + string cwd = Filesystem::getcwd(); + if (filename.find(cwd) == 0) + { + filename = filename.substr(cwd.size()); + while (!filename.empty() && (filename[0] == '/' || filename[0] == '\\')) + filename = filename.substr(1); + } + std::string rbcmd = "$script_args = ["; for (size_t i = 0; i < args.size(); i++) rbcmd += "'" + args[i] + "', ";