Add remove mount capabilities to CLI and UI #62
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user