[studio/modlib] Make Project::mkdir only mkdir if dir does not exist

This commit is contained in:
Gary Talent 2024-05-27 00:47:24 -05:00
parent f9a14433d1
commit 5177cfb0e3

View File

@ -56,9 +56,13 @@ ox::FileSystem &Project::romFs() noexcept {
}
ox::Error Project::mkdir(ox::CRStringView path) const noexcept {
oxReturnError(m_fs.mkdir(path, true));
fileUpdated.emit(path, {});
return {};
auto const [stat, err] = m_fs.stat(path);
if (err) {
oxReturnError(m_fs.mkdir(path, true));
fileUpdated.emit(path, {});
}
return stat.fileType == ox::FileType::Directory ?
ox::Error{} : OxError(1, "path exists as normal file");
}
ox::Result<ox::FileStat> Project::stat(ox::CRStringView path) const noexcept {