mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Fixed this up or something strange like that...
This commit is contained in:
parent
3b737ab87b
commit
dc4c9f0258
@ -115,6 +115,14 @@ extern AMX_NATIVE_INFO g_DataStructNatives[];
|
||||
#define INFINITE 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
#ifndef __linux__
|
||||
#define PATH_SEP_CHAR '\\'
|
||||
#define ALT_SEP_CHAR '/'
|
||||
#else
|
||||
#define PATH_SEP_CHAR '/'
|
||||
#define ALT_SEP_CHAR '\\'
|
||||
#endif
|
||||
|
||||
#ifndef GETPLAYERAUTHID
|
||||
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
|
||||
#endif
|
||||
|
@ -102,7 +102,7 @@ void CLog::CreateNewFile()
|
||||
|
||||
while (true)
|
||||
{
|
||||
snprintf(name, sizeof(name), "%s/L%02d%02d%03d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i);
|
||||
snprintf(name, sizeof(name), "%s%cL%02d%02d%03d.log", g_log_dir.c_str(), PATH_SEP_CHAR, curTime->tm_mon + 1, curTime->tm_mday, i);
|
||||
build_pathname_r(file, sizeof(file)-1, "%s", name);
|
||||
FILE *pTmpFile = fopen(file, "r"); // open for reading to check whether the file exists
|
||||
|
||||
@ -234,6 +234,7 @@ void CLog::Log(const char *fmt, ...)
|
||||
void CLog::LogError(const char *fmt, ...)
|
||||
{
|
||||
static char file[256];
|
||||
static char name[256];
|
||||
|
||||
if (m_FoundError)
|
||||
{
|
||||
@ -257,7 +258,8 @@ void CLog::LogError(const char *fmt, ...)
|
||||
va_end(arglst);
|
||||
|
||||
FILE *pF = NULL;
|
||||
build_pathname_r(file, sizeof(file)-1, "%s/error_%04d%02d%02d.log", g_log_dir.c_str(), (curTime->tm_year + 1900), curTime->tm_mon + 1, curTime->tm_mday);
|
||||
snprintf(name, sizeof(name), "%s%cerror_%04d%02d%02d.log", g_log_dir.c_str(), PATH_SEP_CHAR, curTime->tm_year + 1900, curTime->tm_mon + 1, curTime->tm_mday);
|
||||
build_pathname_r(file, sizeof(file)-1, "%s", name);
|
||||
pF = fopen(file, "a+");
|
||||
|
||||
if (pF)
|
||||
@ -265,7 +267,7 @@ void CLog::LogError(const char *fmt, ...)
|
||||
if (!m_LoggedErrMap)
|
||||
{
|
||||
fprintf(pF, "L %s: Start of error session.\n", date);
|
||||
fprintf(pF, "L %s: Info (map \"%s\") (logfile \"error_%02d%02d%02d.log\")\n", date, STRING(gpGlobals->mapname), curTime->tm_mon + 1, curTime->tm_mday, curTime->tm_year - 100);
|
||||
fprintf(pF, "L %s: Info (map \"%s\") (file \"%s\")\n", date, STRING(gpGlobals->mapname), name);
|
||||
m_LoggedErrMap = true;
|
||||
}
|
||||
fprintf(pF, "L %s: %s\n", date, msg);
|
||||
|
@ -722,13 +722,7 @@ char* build_pathname(char *fmt, ...)
|
||||
{
|
||||
static char string[256];
|
||||
int b;
|
||||
int a = b = snprintf(string, 255,
|
||||
#ifndef __linux__
|
||||
"%s\\",
|
||||
#else
|
||||
"%s/",
|
||||
#endif
|
||||
g_mod_name.c_str());
|
||||
int a = b = snprintf(string, 255, "%s%c", g_mod_name.c_str(), PATH_SEP_CHAR);
|
||||
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
@ -740,11 +734,10 @@ char* build_pathname(char *fmt, ...)
|
||||
|
||||
while (*path)
|
||||
{
|
||||
#ifndef __linux__
|
||||
if (*path == '/') *path = '\\';
|
||||
#else
|
||||
if (*path == '\\') *path = '/';
|
||||
#endif
|
||||
if (*path == ALT_SEP_CHAR)
|
||||
{
|
||||
*path = PATH_SEP_CHAR;
|
||||
}
|
||||
++path;
|
||||
}
|
||||
|
||||
@ -753,13 +746,7 @@ char* build_pathname(char *fmt, ...)
|
||||
|
||||
char *build_pathname_r(char *buffer, size_t maxlen, char *fmt, ...)
|
||||
{
|
||||
snprintf(buffer, maxlen,
|
||||
#ifdef __linux__
|
||||
"%s/",
|
||||
#else
|
||||
"%s\\",
|
||||
#endif
|
||||
g_mod_name.c_str());
|
||||
snprintf(buffer, maxlen, "%s%c", g_mod_name.c_str(), PATH_SEP_CHAR);
|
||||
|
||||
size_t len = strlen(buffer);
|
||||
char *ptr = buffer + len;
|
||||
@ -771,11 +758,10 @@ char *build_pathname_r(char *buffer, size_t maxlen, char *fmt, ...)
|
||||
|
||||
while (*ptr)
|
||||
{
|
||||
#ifndef __linux__
|
||||
if (*ptr == '/') *ptr = '\\';
|
||||
#else
|
||||
if (*ptr == '\\') *ptr = '/';
|
||||
#endif
|
||||
if (*ptr == ALT_SEP_CHAR)
|
||||
{
|
||||
*ptr = PATH_SEP_CHAR;
|
||||
}
|
||||
++ptr;
|
||||
}
|
||||
|
||||
@ -796,23 +782,16 @@ char* build_pathname_addons(char *fmt, ...)
|
||||
|
||||
while (*path)
|
||||
{
|
||||
#ifndef __linux__
|
||||
if (*path == '/') *path = '\\';
|
||||
#else
|
||||
if (*path == '\\') *path = '/';
|
||||
#endif
|
||||
if (*path == ALT_SEP_CHAR)
|
||||
{
|
||||
*path = PATH_SEP_CHAR;
|
||||
}
|
||||
++path;
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
#if defined WIN32
|
||||
#define SEPCHAR '\\'
|
||||
#elif defined __linux__
|
||||
#define SEPCHAR '/'
|
||||
#endif
|
||||
|
||||
bool ConvertModuleName(const char *pathString, String &path)
|
||||
{
|
||||
String local;
|
||||
@ -830,7 +809,7 @@ bool ConvertModuleName(const char *pathString, String &path)
|
||||
/* run to filename instead of dir */
|
||||
char *ptr = tmpname;
|
||||
ptr = tmpname + len - 1;
|
||||
while (ptr >= tmpname && *ptr != SEPCHAR)
|
||||
while (ptr >= tmpname && *ptr != PATH_SEP_CHAR)
|
||||
ptr--;
|
||||
if (ptr >= tmpname)
|
||||
{
|
||||
@ -891,7 +870,7 @@ bool ConvertModuleName(const char *pathString, String &path)
|
||||
}
|
||||
|
||||
path.assign(orig_path);
|
||||
path.append(SEPCHAR);
|
||||
path.append(PATH_SEP_CHAR);
|
||||
path.append(tmpname);
|
||||
path.append("_amxx");
|
||||
#if defined __linux__
|
||||
|
Loading…
Reference in New Issue
Block a user