From 43510a258c83215efcf5e70a253523e8a4199502 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 15 Apr 2017 17:15:28 +0200 Subject: Core/Hotswap: Replace #ifdef conditions with comparisons of values defined in CompilerDefs.h --- src/server/game/Scripting/ScriptReloadMgr.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/server/game/Scripting/ScriptReloadMgr.cpp') diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp index 246d66698d2..3079c548b71 100644 --- a/src/server/game/Scripting/ScriptReloadMgr.cpp +++ b/src/server/game/Scripting/ScriptReloadMgr.cpp @@ -63,10 +63,10 @@ ScriptReloadMgr* ScriptReloadMgr::instance() namespace fs = boost::filesystem; -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include #define HOTSWAP_PLATFORM_REQUIRES_CACHING -#elif __APPLE__ +#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE #include #define HOTSWAP_PLATFORM_REQUIRES_CACHING #else // Posix @@ -82,7 +82,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"; @@ -92,16 +92,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; @@ -130,7 +130,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); @@ -240,7 +240,7 @@ private: template static bool GetFunctionFromSharedLibrary(HandleType handle, std::string const& name, Fn& fn) { -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS fn = reinterpret_cast(GetProcAddress(handle, name.c_str())); #else // Posix fn = reinterpret_cast(dlsym(handle, name.c_str())); @@ -259,7 +259,7 @@ Optional> 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); @@ -403,7 +403,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 @@ -1343,7 +1343,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(); -- cgit v1.2.3