1.1 --- a/core/smn_filesystem.cpp Mon Jan 01 21:18:35 2007 +0000
1.2 +++ b/core/smn_filesystem.cpp Mon Jan 01 21:18:56 2007 +0000
1.3 @@ -51,7 +51,10 @@
1.4 return 0;
1.5 }
1.6
1.7 - IDirectory *pDir = g_LibSys.OpenDirectory(path);
1.8 + char realpath[PLATFORM_MAX_PATH+1];
1.9 + g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), path);
1.10 +
1.11 + IDirectory *pDir = g_LibSys.OpenDirectory(realpath);
1.12 if (!pDir)
1.13 {
1.14 return 0;
1.15 @@ -95,20 +98,36 @@
1.16 }
1.17
1.18 const char *path = pDir->GetEntryName();
1.19 - if ((err=pContext->StringToLocalUTF8(params[2], params[3],path, NULL))
1.20 + if ((err=pContext->StringToLocalUTF8(params[2], params[3], path, NULL))
1.21 != SP_ERROR_NONE)
1.22 {
1.23 pContext->ThrowNativeErrorEx(err, NULL);
1.24 return 0;
1.25 }
1.26
1.27 + pDir->NextEntry();
1.28 +
1.29 return true;
1.30 }
1.31
1.32 +cell_t PrintStuff(IPluginContext *pContext, const cell_t *params)
1.33 +{
1.34 + char *stuff;
1.35 + pContext->LocalToString(params[1], &stuff);
1.36 +
1.37 + FILE *fp = fopen("c:\\debug.txt", "at");
1.38 + fprintf(fp, "%s\n", stuff);
1.39 + fclose(fp);
1.40 +
1.41 + return 0;
1.42 +}
1.43 +
1.44 +static FileNatives s_FileNatives;
1.45
1.46 REGISTER_NATIVES(filesystem)
1.47 {
1.48 {"OpenDirectory", sm_OpenDirectory},
1.49 {"ReadDirEntry", sm_ReadDirEntry},
1.50 + {"PrintStuff", PrintStuff},
1.51 {NULL, NULL},
1.52 };
2.1 --- a/core/smn_string.cpp Mon Jan 01 21:18:35 2007 +0000
2.2 +++ b/core/smn_string.cpp Mon Jan 01 21:18:56 2007 +0000
2.3 @@ -165,5 +165,7 @@
2.4 {"IntToString", sm_numtostr},
2.5 {"StringToFloat", sm_strtofloat},
2.6 {"FloatToString", sm_floattostr},
2.7 + {"Format", sm_format},
2.8 + {"FormatEx", sm_formatex},
2.9 {NULL, NULL},
2.10 };
3.1 --- a/core/sourcemod.cpp Mon Jan 01 21:18:35 2007 +0000
3.2 +++ b/core/sourcemod.cpp Mon Jan 01 21:18:56 2007 +0000
3.3 @@ -200,6 +200,11 @@
3.4 return m_SMBaseDir;
3.5 }
3.6
3.7 +const char *SourceModBase::GetBaseDir()
3.8 +{
3.9 + return g_BaseDir.c_str();
3.10 +}
3.11 +
3.12 SMGlobalClass *SMGlobalClass::head = NULL;
3.13
3.14 SMGlobalClass::SMGlobalClass()
4.1 --- a/core/sourcemod.h Mon Jan 01 21:18:35 2007 +0000
4.2 +++ b/core/sourcemod.h Mon Jan 01 21:18:56 2007 +0000
4.3 @@ -38,6 +38,11 @@
4.4 const char *GetSMBaseDir();
4.5
4.6 /**
4.7 + * @brief Returns the base folder for file natives.
4.8 + */
4.9 + const char *GetBaseDir();
4.10 +
4.11 + /**
4.12 * @brief Returns whether our load in this map is late.
4.13 */
4.14 bool IsLateLoadInMap();