diff options
author | DoctorKraft <DoctorKraft@users.noreply.github.com> | 2017-05-23 19:04:06 +0200 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2017-05-23 19:09:51 +0200 |
commit | 96ef820e20d824d5ff5100175c0852bbfcce1fb3 (patch) | |
tree | e68325836a3904db4f26a7e84e6b6e29c3e5ad0f /src | |
parent | 8d632a9971ac8203255bea431e4f31cb21925100 (diff) |
Core/Hotswap: Fix Reload on Linux
* Closes #19465
(cherry picked from commit 04dfd78dac85f18b3a6d389f2b9f65ab0a534dff)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Scripting/ScriptReloadMgr.cpp | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp index d6547b60d3a..04c15b67c86 100644 --- a/src/server/game/Scripting/ScriptReloadMgr.cpp +++ b/src/server/game/Scripting/ScriptReloadMgr.cpp @@ -66,13 +66,8 @@ namespace fs = boost::filesystem; #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include <windows.h> - #define HOTSWAP_PLATFORM_REQUIRES_CACHING -#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE - #include <dlfcn.h> - #define HOTSWAP_PLATFORM_REQUIRES_CACHING -#else // Posix +#else // Posix and Apple #include <dlfcn.h> - // #define HOTSWAP_PLATFORM_REQUIRES_CACHING #endif // Promote the sScriptReloadMgr to a HotSwapScriptReloadMgr @@ -609,8 +604,6 @@ public: } } - #ifdef HOTSWAP_PLATFORM_REQUIRES_CACHING - temporary_cache_path_ = CalculateTemporaryCachePath(); // We use the boost filesystem function versions which accept @@ -629,8 +622,6 @@ public: // Used to silent compiler warnings (void)code; - #endif // #ifdef HOTSWAP_PLATFORM_REQUIRES_CACHING - // Correct the CMake prefix when needed if (sWorld->getBoolConfig(CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED)) DoCMakePrefixCorrectionIfNeeded(); @@ -867,21 +858,17 @@ private: ASSERT(_running_script_module_names.find(path) == _running_script_module_names.end(), "Can't load a module which is running already!"); - Optional<fs::path> cache_path; - - #ifdef HOTSWAP_PLATFORM_REQUIRES_CACHING - - // Copy the shared library into a cache on platforms which lock files on use (windows). - cache_path = GenerateUniquePathForLibraryInCache(path); + // Copy the shared library into a cache + auto cache_path = GenerateUniquePathForLibraryInCache(path); { boost::system::error_code code; - fs::copy_file(path, *cache_path, fs::copy_option::fail_if_exists, code); + fs::copy_file(path, cache_path, fs::copy_option::fail_if_exists, code); if (code) { TC_LOG_FATAL("scripts.hotswap", ">> Failed to create cache entry for module " "\"%s\" at \"%s\" with reason (\"%s\")!", - path.filename().generic_string().c_str(), cache_path->generic_string().c_str(), + path.filename().generic_string().c_str(), cache_path.generic_string().c_str(), code.message().c_str()); // Find a better solution for this but it's much better @@ -892,11 +879,9 @@ private: } TC_LOG_TRACE("scripts.hotswap", ">> Copied the shared library \"%s\" to \"%s\" for caching.", - path.filename().generic_string().c_str(), cache_path->generic_string().c_str()); + path.filename().generic_string().c_str(), cache_path.generic_string().c_str()); } - #endif // #ifdef HOTSWAP_PLATFORM_REQUIRES_CACHING - auto module = ScriptModule::CreateFromPath(path, cache_path); if (!module) { |