diff --git a/src/olympic/studio/applib/src/studioui.cpp b/src/olympic/studio/applib/src/studioui.cpp index 441c0f4d..04c97e88 100644 --- a/src/olympic/studio/applib/src/studioui.cpp +++ b/src/olympic/studio/applib/src/studioui.cpp @@ -673,14 +673,18 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept { auto p = std::move(*pcIt); std::ignore = config.projects.erase(pcIt); auto &pc = *config.projects.emplace(0, std::move(p)); - for (auto const &f: pc.openFiles) { - auto const openFileErr = openFileActiveTab(f, pc.activeTabItemName == f); - if (openFileErr) { - oxErrorf("\nCould not open editor for file:\n\t{}\nReason:\n\t{}\n", f, toStr(openFileErr)); - continue; - } - m_activeEditor = m_editors.back().value->get(); - } + std::ignore = pc.openFiles.erase( + std::remove_if( + pc.openFiles.begin(), pc.openFiles.end(), + [&](ox::String const &f) { + auto const openFileErr = openFileActiveTab(f, pc.activeTabItemName == f); + if (openFileErr) { + oxErrorf("\nCould not open editor for file:\n\t{}\nReason:\n\t{}\n", f, toStr(openFileErr)); + return true; + } + m_activeEditor = m_editors.back().value->get(); + return false; + })); } else { config.projects.emplace(0, StudioConfig::ProjectConfig{ .projectPath = ox::String{m_project->projectPath()},