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

Function MungePath

Engine/source/platformPOSIX/POSIXFileio.cpp:285–313  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 6

ModifyFileFunction · 0.85
dFileRenameFunction · 0.85
openMethod · 0.85
getFileTimesMethod · 0.85
createPathMethod · 0.85
dumpPathMethod · 0.85

Calls 5

dStrncpyFunction · 0.85
ForwardSlashFunction · 0.85
dSprintfFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected