added new path format functions

exposed helpers as ISourceMod

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40322
This commit is contained in:
David Anderson
2007-01-19 02:14:50 +00:00
parent 2ea877f14b
commit 5c6eebcebf
12 changed files with 181 additions and 39 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ CExtension::CExtension(const char *filename, char *error, size_t err_max)
m_FullyLoaded = false;
char path[PLATFORM_MAX_PATH+1];
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s/extensions/%s", g_SourceMod.GetSMBaseDir(), filename);
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
m_pLib = g_LibSys.OpenLibrary(path, error, err_max);
+3 -1
View File
@@ -282,7 +282,7 @@ ILibrary *LibrarySystem::OpenLibrary(const char *path, char *error, size_t err_m
return new CLibrary(lib);
}
void LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
size_t LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
@@ -298,4 +298,6 @@ void LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
buffer[i] = PLATFORM_SEP_CHAR;
}
}
return mylen;
}
+1 -1
View File
@@ -59,7 +59,7 @@ public:
virtual bool IsPathFile(const char *path);
virtual bool IsPathDirectory(const char *path);
virtual void GetPlatformError(char *error, size_t err_max);
virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...);
virtual size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
};
extern LibrarySystem g_LibSys;
+1 -1
View File
@@ -100,7 +100,7 @@ void CPlugin::InitIdentity()
CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
{
char fullpath[PLATFORM_MAX_PATH+1];
g_LibSys.PathFormat(fullpath, sizeof(fullpath), "%s/plugins/%s", g_SourceMod.GetSMBaseDir(), file);
g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file);
FILE *fp = fopen(fullpath, "rb");
CPlugin *pPlugin = new CPlugin(file);