MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / MungePath

Function MungePath

engine/source/platformEmscripten/EmscriptenFileio.cpp:275–303  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Munge the specified path.

Source from the content-addressed store, hash-verified

273//-----------------------------------------------------------------------------
274// Munge the specified path.
275static void MungePath(char* dest, S32 destSize,
276 const char* src, const char* absolutePrefix)
277{
278 char tempBuf[MaxPath];
279 dStrncpy(dest, src, MaxPath);
280
281 // translate all \ to /
282 ForwardSlash(dest);
283
284 // if it is relative, make it absolute with the absolutePrefix
285 if (dest[0] != '/')
286 {
287 AssertFatal(absolutePrefix, "Absolute Prefix must not be NULL");
288
289 dSprintf(tempBuf, MaxPath, "%s/%s",
290 absolutePrefix, dest);
291
292 // copy the result back into dest
293 dStrncpy(dest, tempBuf, destSize);
294 }
295
296 // if the path exists, we're done
297 struct stat filestat;
298 if (stat(dest, &filestat) != -1)
299 return;
300
301 // otherwise munge the case of the path
302 MungeCase(dest, destSize);
303}
304
305//-----------------------------------------------------------------------------
306enum

Callers 5

ModifyFileFunction · 0.70
openMethod · 0.70
getFileTimesMethod · 0.70
createPathMethod · 0.70
dumpPathMethod · 0.70

Calls 5

dStrncpyFunction · 0.70
ForwardSlashFunction · 0.70
dSprintfFunction · 0.70
statClass · 0.70
MungeCaseFunction · 0.70

Tested by

no test coverage detected