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

Function getDSOPath

Engine/source/console/console.cpp:2413–2468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2411//-----------------------------------------------------------------------------
2412
2413StringTableEntry getDSOPath(const char *scriptPath)
2414{
2415#ifndef TORQUE2D_TOOLS_FIXME
2416
2417 // [tom, 11/17/2006] Force old behavior for the player. May not want to do this.
2418 const char *slash = dStrrchr(scriptPath, '/');
2419 if (slash != NULL)
2420 return StringTable->insertn(scriptPath, slash - scriptPath, true);
2421
2422 slash = dStrrchr(scriptPath, ':');
2423 if (slash != NULL)
2424 return StringTable->insertn(scriptPath, (slash - scriptPath) + 1, true);
2425
2426 return "";
2427
2428#else
2429
2430 char relPath[1024], dsoPath[1024];
2431 bool isPrefs = false;
2432
2433 // [tom, 11/17/2006] Prefs are handled slightly differently to avoid dso name clashes
2434 StringTableEntry prefsPath = Platform::getPrefsPath();
2435 if (dStrnicmp(scriptPath, prefsPath, dStrlen(prefsPath)) == 0)
2436 {
2437 relPath[0] = 0;
2438 isPrefs = true;
2439 }
2440 else
2441 {
2442 StringTableEntry strippedPath = Platform::stripBasePath(scriptPath);
2443 dStrcpy(relPath, strippedPath, 1024);
2444
2445 char *slash = dStrrchr(relPath, '/');
2446 if (slash)
2447 *slash = 0;
2448 }
2449
2450 const char *overridePath;
2451 if (!isPrefs)
2452 overridePath = Con::getVariable("$Scripts::OverrideDSOPath");
2453 else
2454 overridePath = prefsPath;
2455
2456 if (overridePath && *overridePath)
2457 Platform::makeFullPathName(relPath, dsoPath, sizeof(dsoPath), overridePath);
2458 else
2459 {
2460 char t[1024];
2461 dSprintf(t, sizeof(t), "compiledScripts/%s", relPath);
2462 Platform::makeFullPathName(t, dsoPath, sizeof(dsoPath), Platform::getPrefsPath());
2463 }
2464
2465 return StringTable->insert(dsoPath);
2466
2467#endif
2468}
2469
2470//-----------------------------------------------------------------------------

Callers 2

executeFileFunction · 0.85

Calls 8

dStrnicmpFunction · 0.85
dStrcpyFunction · 0.85
getVariableFunction · 0.85
dSprintfFunction · 0.85
insertnMethod · 0.80
dStrrchrFunction · 0.50
dStrlenFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected