Move filesystem natives from Core to Logic (bug 5606, r=psychonic).

--HG--
rename : core/smn_filesystem.cpp => core/logic/smn_filesystem.cpp
This commit is contained in:
David Anderson
2013-02-16 15:52:11 -08:00
parent 7814acb9f8
commit 5f0a55057e
8 changed files with 149 additions and 126 deletions
+39 -9
View File
@@ -51,19 +51,19 @@
#include "HalfLife2.h"
#include "CoreConfig.h"
#if defined _WIN32
#define MATCHMAKINGDS_SUFFIX ""
#define MATCHMAKINGDS_EXT "dll"
#elif defined __APPLE__
#define MATCHMAKINGDS_SUFFIX ""
#define MATCHMAKINGDS_EXT "dylib"
#elif defined __linux__
#if defined _WIN32
#define MATCHMAKINGDS_SUFFIX ""
#define MATCHMAKINGDS_EXT "dll"
#elif defined __APPLE__
#define MATCHMAKINGDS_SUFFIX ""
#define MATCHMAKINGDS_EXT "dylib"
#elif defined __linux__
#if SOURCE_ENGINE < SE_LEFT4DEAD2
#define MATCHMAKINGDS_SUFFIX "_i486"
#else
#define MATCHMAKINGDS_SUFFIX ""
#endif
#define MATCHMAKINGDS_EXT "so"
#endif
#define MATCHMAKINGDS_EXT "so"
#endif
static ILibrary *g_pLogic = NULL;
@@ -109,6 +109,32 @@ static void log_error(const char *fmt, ...)
va_end(ap);
}
static void log_message(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
g_Logger.LogMessageEx(fmt, ap);
va_end(ap);
}
static void log_to_file(FILE *fp, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
g_Logger.LogToOpenFileEx(fp, fmt, ap);
va_end(ap);
}
static void log_to_game(const char *message)
{
Engine_LogPrintWrapper(message);
}
static bool file_exists(const char *path)
{
return basefilesystem->FileExists(path);
}
static void generate_error(IPluginContext *ctx, cell_t func_idx, int err, const char *fmt, ...)
{
va_list ap;
@@ -214,6 +240,10 @@ static sm_core_t core_bridge =
strncopy,
UTIL_TrimWhitespace,
log_error,
log_message,
log_to_file,
log_to_game,
file_exists,
get_cvar_string,
UTIL_Format,
generate_error,