[studio] Fix New Project opening project, disable New if no project open
Some checks failed
Build / build (push) Has been cancelled

This commit is contained in:
Gary Talent 2025-02-25 20:01:33 -06:00
parent 646ab1283f
commit c3f9cf9a64
2 changed files with 3 additions and 2 deletions

View File

@ -156,7 +156,7 @@ void StudioUI::draw() noexcept {
void StudioUI::drawMenu() noexcept {
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("New...", "Ctrl+N")) {
if (ImGui::MenuItem("New...", "Ctrl+N", false, m_project)) {
m_newMenu.open();
}
if (ImGui::MenuItem("New Project...", "Ctrl+Shift+N")) {

View File

@ -84,10 +84,11 @@ ox::FileSystem &Project::romFs() noexcept {
}
ox::Error Project::mkdir(ox::StringViewCR path) const noexcept {
auto const [stat, err] = m_fs.stat(path);
auto [stat, err] = m_fs.stat(path);
if (err) {
OX_RETURN_ERROR(m_fs.mkdir(path, true));
dirAdded.emit(path);
OX_RETURN_ERROR(m_fs.stat(path).moveTo(stat));
}
return stat.fileType == ox::FileType::Directory ?
ox::Error{} : ox::Error{1, "path exists as normal file"};