| 2330 | //----------------------------------------------------------------------------- |
| 2331 | |
| 2332 | StringTableEntry getDSOPath(const char *scriptPath) |
| 2333 | { |
| 2334 | #ifndef TORQUE2D_TOOLS_FIXME |
| 2335 | |
| 2336 | // [tom, 11/17/2006] Force old behavior for the player. May not want to do this. |
| 2337 | const char *slash = dStrrchr(scriptPath, '/'); |
| 2338 | if (slash != NULL) |
| 2339 | return StringTable->insertn(scriptPath, slash - scriptPath, true); |
| 2340 | |
| 2341 | slash = dStrrchr(scriptPath, ':'); |
| 2342 | if (slash != NULL) |
| 2343 | return StringTable->insertn(scriptPath, (slash - scriptPath) + 1, true); |
| 2344 | |
| 2345 | return ""; |
| 2346 | |
| 2347 | #else |
| 2348 | |
| 2349 | char relPath[1024], dsoPath[1024]; |
| 2350 | bool isPrefs = false; |
| 2351 | |
| 2352 | // [tom, 11/17/2006] Prefs are handled slightly differently to avoid dso name clashes |
| 2353 | StringTableEntry prefsPath = Platform::getPrefsPath(); |
| 2354 | if (dStrnicmp(scriptPath, prefsPath, dStrlen(prefsPath)) == 0) |
| 2355 | { |
| 2356 | relPath[0] = 0; |
| 2357 | isPrefs = true; |
| 2358 | } |
| 2359 | else |
| 2360 | { |
| 2361 | StringTableEntry strippedPath = Platform::stripBasePath(scriptPath); |
| 2362 | dStrcpy(relPath, strippedPath); |
| 2363 | |
| 2364 | char *slash = dStrrchr(relPath, '/'); |
| 2365 | if (slash) |
| 2366 | *slash = 0; |
| 2367 | } |
| 2368 | |
| 2369 | const char *overridePath; |
| 2370 | if (!isPrefs) |
| 2371 | overridePath = Con::getVariable("$Scripts::OverrideDSOPath"); |
| 2372 | else |
| 2373 | overridePath = prefsPath; |
| 2374 | |
| 2375 | if (overridePath && *overridePath) |
| 2376 | Platform::makeFullPathName(relPath, dsoPath, sizeof(dsoPath), overridePath); |
| 2377 | else |
| 2378 | { |
| 2379 | char t[1024]; |
| 2380 | dSprintf(t, sizeof(t), "compiledScripts/%s", relPath); |
| 2381 | Platform::makeFullPathName(t, dsoPath, sizeof(dsoPath), Platform::getPrefsPath()); |
| 2382 | } |
| 2383 | |
| 2384 | return StringTable->insert(dsoPath); |
| 2385 | |
| 2386 | #endif |
| 2387 | } |
| 2388 | |
| 2389 | //----------------------------------------------------------------------------- |
no test coverage detected