[studio] Add confirmation dialog for file deletion, move deletion to Project
All checks were successful
Build / build (push) Successful in 3m16s
All checks were successful
Build / build (push) Successful in 3m16s
This commit is contained in:
@@ -45,7 +45,7 @@ constexpr ox::StringView parentDir(ox::StringView path) noexcept {
|
||||
return substr(path, 0, extStart);
|
||||
}
|
||||
|
||||
class Project {
|
||||
class Project: public ox::SignalHandler {
|
||||
private:
|
||||
ox::SmallMap<ox::String, ox::Optional<ox::ClawFormat>> m_typeFmt;
|
||||
keel::Context &m_ctx;
|
||||
@@ -91,6 +91,8 @@ class Project {
|
||||
|
||||
ox::Result<ox::FileStat> stat(ox::StringViewCR path) const noexcept;
|
||||
|
||||
ox::Error deleteItem(ox::StringViewCR path) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
bool exists(ox::StringViewCR path) const noexcept;
|
||||
|
||||
|
||||
@@ -69,6 +69,14 @@ ox::Result<ox::FileStat> Project::stat(ox::StringViewCR path) const noexcept {
|
||||
return m_fs.stat(path);
|
||||
}
|
||||
|
||||
ox::Error Project::deleteItem(ox::StringViewCR path) noexcept {
|
||||
auto const err = m_fs.remove(path);
|
||||
if (!err) {
|
||||
fileDeleted.emit(path);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
bool Project::exists(ox::StringViewCR path) const noexcept {
|
||||
return m_fs.stat(path).error == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user