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

Function ensureTrailingSlash

Engine/source/console/console.cpp:2309–2328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2307
2308
2309void ensureTrailingSlash(char* pDstPath, const char* pSrcPath)
2310{
2311 // Copy to target.
2312 dStrcpy(pDstPath, pSrcPath);
2313
2314 // Find trailing character index.
2315 S32 trailIndex = dStrlen(pDstPath);
2316
2317 // Ignore if empty string.
2318 if (trailIndex == 0)
2319 return;
2320
2321 // Finish if the trailing slash already exists.
2322 if (pDstPath[trailIndex - 1] == '/')
2323 return;
2324
2325 // Add trailing slash.
2326 pDstPath[trailIndex++] = '/';
2327 pDstPath[trailIndex] = 0;
2328}
2329
2330//-----------------------------------------------------------------------------
2331

Callers 1

expandPathFunction · 0.85

Calls 2

dStrcpyFunction · 0.85
dStrlenFunction · 0.50

Tested by

no test coverage detected