MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / BuildPath

Method BuildPath

core/sourcemod.cpp:420–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, const char *format, ...)
421{
422 char _buffer[PLATFORM_MAX_PATH];
423 va_list ap;
424
425 va_start(ap, format);
426 vsnprintf(_buffer, PLATFORM_MAX_PATH, format, ap);
427 va_end(ap);
428
429 /* If we get a "file://" notation, strip off the file:// part so we're left
430 * with an absolute path. Note that the absolute path gets returned, so
431 * usage with relative paths here is completely invalid.
432 */
433 if (type != Path_SM_Rel && strncmp(_buffer, "file://", 7) == 0)
434 {
435 return ke::path::Format(buffer, maxlength, "%s", &_buffer[7]);
436 }
437
438 const char *base = NULL;
439 if (type == Path_Game)
440 {
441 base = GetGamePath();
442 }
443 else if (type == Path_SM)
444 {
445 base = GetSourceModPath();
446 }
447 else if (type == Path_SM_Rel)
448 {
449 base = m_SMRelDir;
450 }
451
452 if (base)
453 {
454 return ke::path::Format(buffer, maxlength, "%s/%s", base, _buffer);
455 }
456 else
457 {
458 return ke::path::Format(buffer, maxlength, "%s", _buffer);
459 }
460}
461
462void SourceModBase::CloseSourceMod()
463{

Callers 15

ReadSMC_NewSectionMethod · 0.80
SM_ExecuteConfigFunction · 0.80
ReparseFileMethod · 0.80
sm_OpenDirectoryFunction · 0.80
sm_OpenFileFunction · 0.80
sm_DeleteFileFunction · 0.80
sm_FileExistsFunction · 0.80
sm_RenameFileFunction · 0.80
sm_DirExistsFunction · 0.80
sm_FileSizeFunction · 0.80
sm_SetFilePermissionsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected