[studio/applib] Make Studio remove files unable to be opened from open file list in config
This commit is contained in:
@ -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()},
|
||||
|
Reference in New Issue
Block a user