MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / ensureTrailingSlash

Function ensureTrailingSlash

Engine/source/console/console.cpp:2390–2409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2388
2389
2390void ensureTrailingSlash(char* pDstPath, const char* pSrcPath, S32 dstSize)
2391{
2392 // Copy to target.
2393 dStrcpy(pDstPath, pSrcPath, dstSize);
2394
2395 // Find trailing character index.
2396 S32 trailIndex = dStrlen(pDstPath);
2397
2398 // Ignore if empty string.
2399 if (trailIndex == 0)
2400 return;
2401
2402 // Finish if the trailing slash already exists.
2403 if (pDstPath[trailIndex - 1] == '/')
2404 return;
2405
2406 // Add trailing slash.
2407 pDstPath[trailIndex++] = '/';
2408 pDstPath[trailIndex] = 0;
2409}
2410
2411//-----------------------------------------------------------------------------
2412

Callers 1

expandPathFunction · 0.85

Calls 2

dStrcpyFunction · 0.85
dStrlenFunction · 0.50

Tested by

no test coverage detected