core/smn_filesystem.cpp
changeset 2307 cc1c784f8754
parent 2289 44045ead61cd
child 2431 129622e13d06
     1.1 --- a/core/smn_filesystem.cpp	Mon Sep 15 04:28:26 2008 -0500
     1.2 +++ b/core/smn_filesystem.cpp	Wed Sep 17 02:07:19 2008 -0500
     1.3 @@ -487,6 +487,21 @@
     1.4  #endif
     1.5  }
     1.6  
     1.7 +static cell_t sm_CreateDirectory(IPluginContext *pContext, const cell_t *params)
     1.8 +{
     1.9 +	char *name;
    1.10 +	char realpath[PLATFORM_MAX_PATH];
    1.11 +
    1.12 +	pContext->LocalToString(params[1], &name);
    1.13 +	g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
    1.14 +
    1.15 +#if defined PLATFORM_WINDOWS
    1.16 +	return mkdir(realpath) == 0;
    1.17 +#else
    1.18 +	return mkdir(realpath, params[2]) == 0;
    1.19 +#endif
    1.20 +}
    1.21 +
    1.22  static cell_t sm_RemoveDir(IPluginContext *pContext, const cell_t *params)
    1.23  {
    1.24  	char *name;
    1.25 @@ -959,5 +974,6 @@
    1.26  	{"WriteFileString",			sm_WriteFileString},
    1.27  	{"AddGameLogHook",			sm_AddGameLogHook},
    1.28  	{"RemoveGameLogHook",		sm_RemoveGameLogHook},
    1.29 +	{"CreateDirectory",			sm_CreateDirectory},
    1.30  	{NULL,						NULL},
    1.31  };