refactor
This commit is contained in:
parent
793ec5b4a5
commit
eb4fe4ff60
@ -459,21 +459,23 @@ auto open_file::close() -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = get_api_error();
|
||||||
|
|
||||||
nf_->close();
|
nf_->close();
|
||||||
|
|
||||||
if (modified_) {
|
if (modified_) {
|
||||||
if (get_api_error() == api_error::success) {
|
if (err == api_error::success) {
|
||||||
mgr_.queue_upload(*this);
|
mgr_.queue_upload(*this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_api_error() == api_error::download_incomplete) {
|
if (err == api_error::download_incomplete) {
|
||||||
mgr_.store_resume(*this);
|
mgr_.store_resume(*this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_api_error() == api_error::success) {
|
if (err == api_error::success) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,17 +237,27 @@ auto open_file_base::is_modified() const -> bool {
|
|||||||
|
|
||||||
void open_file_base::remove(std::uint64_t handle) {
|
void open_file_base::remove(std::uint64_t handle) {
|
||||||
recur_mutex_lock file_lock(file_mtx_);
|
recur_mutex_lock file_lock(file_mtx_);
|
||||||
|
if (open_data_.find(handle) == open_data_.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
open_data_.erase(handle);
|
open_data_.erase(handle);
|
||||||
event_system::instance().raise<filesystem_item_handle_closed>(
|
event_system::instance().raise<filesystem_item_handle_closed>(
|
||||||
fsi_.api_path, handle, fsi_.source_path, fsi_.directory, modified_);
|
fsi_.api_path, handle, fsi_.source_path, fsi_.directory, modified_);
|
||||||
if (open_data_.empty()) {
|
if (not open_data_.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event_system::instance().raise<filesystem_item_closed>(
|
event_system::instance().raise<filesystem_item_closed>(
|
||||||
fsi_.api_path, fsi_.source_path, fsi_.directory, modified_);
|
fsi_.api_path, fsi_.source_path, fsi_.directory, modified_);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void open_file_base::remove_all() {
|
void open_file_base::remove_all() {
|
||||||
recur_mutex_lock file_lock(file_mtx_);
|
recur_mutex_lock file_lock(file_mtx_);
|
||||||
|
if (open_data_.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto open_data = open_data_;
|
auto open_data = open_data_;
|
||||||
open_data_.clear();
|
open_data_.clear();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user