| 299 | }; |
| 300 | |
| 301 | bool 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 |
no test coverage detected