diff --git a/src/olympic/studio/applib/src/newmenu.cpp b/src/olympic/studio/applib/src/newmenu.cpp index 828de7c2..a0b5be55 100644 --- a/src/olympic/studio/applib/src/newmenu.cpp +++ b/src/olympic/studio/applib/src/newmenu.cpp @@ -165,13 +165,13 @@ void NewMenu::finish(StudioContext &sctx) noexcept { return; } auto const&im = *m_types[m_selectedType]; - if (sctx.project->exists(im.itemPath(m_itemName))) { + auto const path = m_path.len() ? + im.itemPath(m_itemName, m_path) : im.itemPath(m_itemName); + if (sctx.project->exists(path)) { oxLogError(ox::Error{1, "New file error: file already exists"}); return; } - auto const [path, err] = - im.write(sctx, m_itemName, m_selectedTemplate); - if (err) { + if (auto const err = im.write(sctx, path, m_selectedTemplate)) { oxLogError(err); return; }