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

Function collapseScriptFilename

Engine/source/console/scriptFilename.cpp:301–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299};
300
301bool collapseScriptFilename(char *filename, U32 size, const char *src)
302{
303 PathExpando *tools = sgPathExpandos.retreive("tools");
304 PathExpando *game = sgPathExpandos.retreive("game");
305
306 CollapseTest test[]=
307 {
308 { game ? game->mPath : NULL, "~" },
309 { tools ? tools->mPath : NULL, "^tools" },
310 { Platform::getCurrentDirectory(), "" },
311 { Platform::getMainDotCsDir(), "" },
312 { NULL, NULL }
313 };
314
315 for(S32 i = 0;!(test[i].path == NULL && test[i].replace == NULL);++i)
316 {
317 if(test[i].path == NULL) continue;
318
319 StringTableEntry base = tryGetBasePath(src, test[i].path);
320 if(base == NULL)
321 continue;
322
323 StringTableEntry rel = Platform::makeRelativePathName(src, test[i].path);
324
325 *filename = 0;
326 if(*test[i].replace)
327 dSprintf(filename, size, "%s/", test[i].replace);
328 dStrcat(filename, rel);
329 return true;
330 }
331
332 dStrncpy(filename, src, size - 1);
333 filename[size-1] = 0;
334 return true;
335}
336
337//-----------------------------------------------------------------------------
338

Callers 4

scriptFilename.cppFile · 0.85
writeFieldsMethod · 0.85
updateObjectMethod · 0.85
compileStaticFieldsMethod · 0.85

Calls 5

tryGetBasePathFunction · 0.85
dSprintfFunction · 0.85
dStrcatFunction · 0.85
dStrncpyFunction · 0.85
retreiveMethod · 0.45

Tested by

no test coverage detected