diff --git a/src/olympic/studio/applib/src/studioui.cpp b/src/olympic/studio/applib/src/studioui.cpp index 9a673420..fa2c7a2d 100644 --- a/src/olympic/studio/applib/src/studioui.cpp +++ b/src/olympic/studio/applib/src/studioui.cpp @@ -406,9 +406,14 @@ void StudioUI::drawTabs() noexcept { m_closeActiveTab = false; } if (m_navAction) { - oxLogError(openFile(m_navAction->path)); - m_activeEditor->navigateTo(m_navAction->args); - m_navAction.reset(); + if (!openFile(m_navAction->path)) { + m_activeEditor->navigateTo(m_navAction->args); + m_navAction.reset(); + } else { + //auto const i = m_sctx.navIdx - 1; + //oxDebugf("deleting {}", m_sctx.navStack[i].filePath); + //std::ignore = m_sctx.navStack.erase(i); + } } } @@ -679,7 +684,10 @@ ox::Error StudioUI::openFile(ox::StringViewCR path) noexcept { ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool const makeActiveTab) noexcept { if (!m_project) { - return ox::Error(1, "No project open to open a file from"); + return ox::Error(1, "no project open to open a file from"); + } + if (!m_project->romFs().exists(path)) { + return ox::Error{1, "file does note exist"}; } if (m_openFiles.contains(path)) { for (auto &e : m_editors) { diff --git a/src/olympic/turbine/src/glfw/turbine.cpp b/src/olympic/turbine/src/glfw/turbine.cpp index ff02f4d0..5d740953 100644 --- a/src/olympic/turbine/src/glfw/turbine.cpp +++ b/src/olympic/turbine/src/glfw/turbine.cpp @@ -402,14 +402,14 @@ ox::Error run(Context &ctx) noexcept { glfwPollEvents(); auto const ticks = ticksMs(ctx); if (ctx.wakeupTime <= ticks) { - auto const st = ctx.updateHandler(ctx); - if (st >= 0) { - ctx.wakeupTime = ticks + static_cast(st); - sleepTime = static_cast(st); - } else { - ctx.wakeupTime = ~uint64_t{0}; - sleepTime = ctx.wakeupTime - ticks; - } + auto const st = ctx.updateHandler(ctx); + if (st >= 0) { + ctx.wakeupTime = ticks + static_cast(st); + sleepTime = static_cast(st); + } else { + ctx.wakeupTime = ~uint64_t{0}; + sleepTime = ctx.wakeupTime - ticks; + } } else { sleepTime = ctx.wakeupTime - ticks; }