attempted some thread improvements[?]
fixed moduleconf bug what
This commit is contained in:
@ -19,6 +19,30 @@ int SetMysqlAffinity(AMX *amx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DirExists(const char *dir)
|
||||
{
|
||||
#if defined WIN32 || defined _WIN32
|
||||
DWORD attr = GetFileAttributes(dir);
|
||||
|
||||
if (attr == INVALID_FILE_ATTRIBUTES)
|
||||
return false;
|
||||
|
||||
if (attr & FILE_ATTRIBUTE_DIRECTORY)
|
||||
return true;
|
||||
|
||||
#else
|
||||
struct stat s;
|
||||
|
||||
if (stat(dir, &s) != 0)
|
||||
return false;
|
||||
|
||||
if (S_ISDIR(s.st_mode))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
MF_AddNatives(g_BaseSqlNatives);
|
||||
@ -29,7 +53,18 @@ void OnAmxxAttach()
|
||||
|
||||
//override any mysqlx old compat stuff
|
||||
MF_AddNatives(g_OldCompatNatives);
|
||||
MF_OverrideNatives(g_OldCompatNatives);
|
||||
MF_OverrideNatives(g_OldCompatNatives, MODULE_NAME);
|
||||
|
||||
char path[255];
|
||||
MF_BuildPathnameR(path, sizeof(path)-1, "%s/sqlite3", MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data"));
|
||||
if (!DirExists(path))
|
||||
{
|
||||
mkdir(path
|
||||
#if defined __linux__
|
||||
, 0775
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void OnAmxxDetach()
|
||||
|
Reference in New Issue
Block a user