------------------------------------------------------------------------------------------------ Determine the exact location of a LWO file
| 458 | // ------------------------------------------------------------------------------------------------ |
| 459 | // Determine the exact location of a LWO file |
| 460 | std::string LWSImporter::FindLWOFile(const std::string &in) { |
| 461 | // insert missing directory separator if necessary |
| 462 | std::string tmp(in); |
| 463 | if (in.length() > 3 && in[1] == ':' && in[2] != '\\' && in[2] != '/') { |
| 464 | tmp = in[0] + (std::string(":\\") + in.substr(2)); |
| 465 | } |
| 466 | |
| 467 | if (io->Exists(tmp)) { |
| 468 | return in; |
| 469 | } |
| 470 | |
| 471 | // file is not accessible for us ... maybe it's packed by |
| 472 | // LightWave's 'Package Scene' command? |
| 473 | |
| 474 | // Relevant for us are the following two directories: |
| 475 | // <folder>\Objects\<hh>\<*>.lwo |
| 476 | // <folder>\Scenes\<hh>\<*>.lws |
| 477 | // where <hh> is optional. |
| 478 | |
| 479 | std::string test = std::string("..") + (io->getOsSeparator() + tmp); |
| 480 | if (io->Exists(test)) { |
| 481 | return test; |
| 482 | } |
| 483 | |
| 484 | test = std::string("..") + (io->getOsSeparator() + test); |
| 485 | if (io->Exists(test)) { |
| 486 | return test; |
| 487 | } |
| 488 | |
| 489 | // return original path, maybe the IOsystem knows better |
| 490 | return tmp; |
| 491 | } |
| 492 | |
| 493 | // ------------------------------------------------------------------------------------------------ |
| 494 | // Read file into given scene data structure |
nothing calls this directly
no test coverage detected