Add remove mount capabilities to CLI and UI #62

This commit is contained in:
2025-10-07 12:25:41 -05:00
parent 06ede16148
commit 53a911f207
3 changed files with 5 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ private:
private:
[[nodiscard]] auto get_lock_data_file() const -> std::string;
[[nodiscard]] auto get_lock_file() const -> std::string;
[[nodiscard]] auto get_lock_file(bool create_parent = true) const -> std::string;
[[nodiscard]] auto get_state_directory() const -> std::string;

View File

@@ -60,9 +60,9 @@ auto lock_data::get_lock_data_file() const -> std::string {
});
}
auto lock_data::get_lock_file() const -> std::string {
auto lock_data::get_lock_file(bool create_parent) const -> std::string {
auto dir = get_state_directory();
if (not utils::file::directory(dir).create_directory()) {
if (create_parent && not utils::file::directory(dir).create_directory()) {
throw startup_exception("failed to create directory|sp|" + dir + "|err|" +
std::to_string(utils::get_last_error_code()));
}
@@ -128,7 +128,7 @@ void lock_data::release() {
}
if (lock_status_ == 0) {
[[maybe_unused]] auto success{utils::file::file{get_lock_file()}.remove()};
[[maybe_unused]] auto success{utils::file::file{get_lock_file(false)}.remove()};
flock(handle_, LOCK_UN);
}

View File

@@ -53,6 +53,7 @@ namespace repertory::cli::actions {
utils::collection::to_hex_string(
utils::generate_secure_random<data_buffer>(4U))),
});
if (utils::file::directory{data_directory}.move_to(trash_path)) {
return cli::handle_error(
exit_code::success,