attempted some thread improvements[?]

fixed moduleconf bug
what
This commit is contained in:
David Anderson
2006-06-03 22:26:43 +00:00
parent 7367f29cb4
commit 34f5b3257d
8 changed files with 72 additions and 18 deletions

View File

@ -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()