| 454 | } |
| 455 | |
| 456 | void Renderer::loadScript(const std::filesystem::path& path) |
| 457 | { |
| 458 | FALCOR_ASSERT(!path.empty()); |
| 459 | |
| 460 | try |
| 461 | { |
| 462 | if (getProgressBar().isActive()) |
| 463 | getProgressBar().show("Loading Configuration"); |
| 464 | |
| 465 | // Add script directory to search paths (add it to the front to make it highest priority). |
| 466 | AssetResolver oldResolver = AssetResolver::getDefaultResolver(); |
| 467 | auto directory = std::filesystem::absolute(path).parent_path(); |
| 468 | AssetResolver::getDefaultResolver().addSearchPath(directory, SearchPathPriority::First); |
| 469 | |
| 470 | Scripting::runScriptFromFile(path); |
| 471 | |
| 472 | // Restore asset resolver. |
| 473 | AssetResolver::getDefaultResolver() = oldResolver; |
| 474 | } |
| 475 | catch (const std::exception& e) |
| 476 | { |
| 477 | std::string msg = fmt::format("Error when loading configuration file: {}\n{}", path, e.what()); |
| 478 | if (is_set(getErrorDiagnosticFlags(), ErrorDiagnosticFlags::ShowMessageBoxOnError)) |
| 479 | reportErrorAndContinue(msg); |
| 480 | else |
| 481 | FALCOR_THROW(msg); |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | void Renderer::saveConfigDialog() |
| 486 | { |
nothing calls this directly
no test coverage detected