diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-04-15 17:15:28 +0200 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2017-05-23 18:16:02 +0200 |
commit | cb5d22a6cbe3d8fa2fc1218b2ab87d208763ff63 (patch) | |
tree | 0985bbb208bbc401dc6e3bdb32a484524127987a /src/server/game/Scripting/ScriptReloadMgr.cpp | |
parent | 5032fb462e4329b31632a9adb3f795ca14af4273 (diff) |
Core/Hotswap: Replace #ifdef conditions with comparisons of values defined in CompilerDefs.h
(cherry picked from commit 43510a258c83215efcf5e70a253523e8a4199502)
Diffstat (limited to 'src/server/game/Scripting/ScriptReloadMgr.cpp')
-rw-r--r-- | src/server/game/Scripting/ScriptReloadMgr.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp index 72f935e5cd1..208f5c1b3a5 100644 --- a/src/server/game/Scripting/ScriptReloadMgr.cpp +++ b/src/server/game/Scripting/ScriptReloadMgr.cpp @@ -64,7 +64,7 @@ ScriptReloadMgr* ScriptReloadMgr::instance() namespace fs = boost::filesystem; -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include <windows.h> #define HOTSWAP_PLATFORM_REQUIRES_CACHING #elif __APPLE__ @@ -83,7 +83,7 @@ namespace fs = boost::filesystem; // Returns "" on Windows and "lib" on posix. static char const* GetSharedLibraryPrefix() { -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS return ""; #else // Posix return "lib"; @@ -93,16 +93,16 @@ static char const* GetSharedLibraryPrefix() // Returns "dll" on Windows, "dylib" on OS X, and "so" on posix. static char const* GetSharedLibraryExtension() { -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS return "dll"; -#elif __APPLE__ +#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE return "dylib"; #else // Posix return "so"; #endif } -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS typedef HMODULE HandleType; #else // Posix typedef void* HandleType; @@ -131,7 +131,7 @@ public: void operator() (HandleType handle) const { // Unload the associated shared library. -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS bool success = (FreeLibrary(handle) != 0); #else // Posix bool success = (dlclose(handle) == 0); @@ -241,7 +241,7 @@ private: template<typename Fn> static bool GetFunctionFromSharedLibrary(HandleType handle, std::string const& name, Fn& fn) { -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS fn = reinterpret_cast<Fn>(GetProcAddress(handle, name.c_str())); #else // Posix fn = reinterpret_cast<Fn>(dlsym(handle, name.c_str())); @@ -260,7 +260,7 @@ Optional<std::shared_ptr<ScriptModule>> return path; }(); -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS HandleType handle = LoadLibrary(load_path.generic_string().c_str()); #else // Posix HandleType handle = dlopen(load_path.generic_string().c_str(), RTLD_LAZY); @@ -404,7 +404,7 @@ static std::string CalculateScriptModuleProjectName(std::string const& module) /// could block the rebuild of new shared libraries. static bool IsDebuggerBlockingRebuild() { -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS if (IsDebuggerPresent()) return true; #endif @@ -1344,7 +1344,7 @@ private: auto current_path = fs::current_path(); - #ifndef _WIN32 + #if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS // The worldserver location is ${CMAKE_INSTALL_PREFIX}/bin // on all other platforms then windows current_path = current_path.parent_path(); |