| 553 | namespace |
| 554 | { |
| 555 | void GetAbsoluteSearchPaths(StringUtils::StringVec & searchpaths, |
| 556 | const StringUtils::StringVec & pathStrings, |
| 557 | const std::string & workingDir, |
| 558 | const EnvMap & map, |
| 559 | UsedEnvs & envs) |
| 560 | { |
| 561 | if(pathStrings.empty()) |
| 562 | { |
| 563 | searchpaths.push_back(workingDir); |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | // TODO: Improve the algorithm to collect context variables per search_path. |
| 568 | |
| 569 | for (unsigned int i = 0; i < pathStrings.size(); ++i) |
| 570 | { |
| 571 | // Resolve variables in case the expansion adds slashes |
| 572 | const std::string resolved = ResolveContextVariables(pathStrings[i], map, envs); |
| 573 | |
| 574 | // Remove trailing "/", and spaces |
| 575 | std::string dirname = StringUtils::RightTrim(StringUtils::Trim(resolved), '/'); |
| 576 | |
| 577 | if (!pystring::os::path::isabs(dirname)) |
| 578 | { |
| 579 | dirname = pystring::os::path::join(workingDir, dirname); |
| 580 | } |
| 581 | |
| 582 | searchpaths.push_back(pystring::os::path::normpath(dirname)); |
| 583 | } |
| 584 | } |
| 585 | } // anon. |
| 586 | |
| 587 | } // namespace OCIO_NAMESPACE |
no test coverage detected