aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptReloadMgr.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-04-15 17:15:28 +0200
committerShauren <shauren.trinity@gmail.com>2017-04-15 17:15:28 +0200
commit43510a258c83215efcf5e70a253523e8a4199502 (patch)
treec84910f8f56b69cdcfab6de91c43b15d6f4a6b36 /src/server/game/Scripting/ScriptReloadMgr.cpp
parent65a266f1c9cb6080dbde604440564dc517a7dcc7 (diff)
Core/Hotswap: Replace #ifdef conditions with comparisons of values defined in CompilerDefs.h
Diffstat (limited to 'src/server/game/Scripting/ScriptReloadMgr.cpp')
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp22
1 files changed, 11 insertions, 11 deletions
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 <windows.h>
#define HOTSWAP_PLATFORM_REQUIRES_CACHING
-#elif __APPLE__
+#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE
#include <dlfcn.h>
#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<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()));
@@ -259,7 +259,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);
@@ -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();