From 809669d18946ca219b9f0e1c6a26900167c77660 Mon Sep 17 00:00:00 2001 From: eroen Date: Mon, 17 Jul 2017 00:35:32 +0200 Subject: [PATCH 3/5] respect DFHACK_PLUGIN_DESTINATION --- CMakeLists.txt | 2 +- library/CMakeLists.txt | 4 +++- library/PluginManager.cpp | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06251b45..8be3c971 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,7 +160,7 @@ SET(DFHACK_BINARY_DESTINATION .) # dfhack data goes here: SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") # plugin libs go here: -SET(DFHACK_PLUGIN_DESTINATION hack/plugins) +SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") # dfhack header files go here: SET(DFHACK_INCLUDES_DESTINATION hack/include) # dfhack lua files go here: diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 6ca16c4b..f9f35700 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -76,7 +76,9 @@ RemoteTools.cpp ) set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS - "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"") + "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) +set_property( SOURCE "PluginManager.cpp" APPEND PROPERTY COMPILE_DEFINITIONS + "DFHACK_PLUGIN_DESTINATION=\"${DFHACK_PLUGIN_DESTINATION}\"" ) SET(MAIN_SOURCES_WINDOWS Console-windows.cpp diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index a4927a75..a4cefb13 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -52,6 +52,7 @@ using namespace std; using namespace tthread; #include +#include #define MUTEX_GUARD(lock) auto lock_##__LINE__ = make_mutex_guard(lock); template @@ -70,7 +71,11 @@ tthread::lock_guard make_mutex_guard (T *mutex) static string getPluginPath() { - return Core::getInstance().getHackPath() + "plugins/"; + if(strncmp(DFHACK_PLUGIN_DESTINATION, "hack/plugins", 13) == 0) + // This is the default value + return Core::getInstance().getHackPath() + "plugins/"; + else + return DFHACK_PLUGIN_DESTINATION "/"; } static string getPluginPath (std::string name) -- 2.13.0