refactor
This commit is contained in:
@ -431,26 +431,27 @@ auto open_file::native_operation(
|
||||
: new_file_size % chunk_size_);
|
||||
}
|
||||
|
||||
if (original_file_size != new_file_size) {
|
||||
set_modified();
|
||||
if (original_file_size == new_file_size) {
|
||||
return res;
|
||||
}
|
||||
set_modified();
|
||||
|
||||
fsi_.size = new_file_size;
|
||||
auto now = std::to_string(utils::time::get_time_now());
|
||||
res = provider_.set_item_meta(
|
||||
fsi_.api_path, {
|
||||
{META_CHANGED, now},
|
||||
{META_MODIFIED, now},
|
||||
{META_SIZE, std::to_string(new_file_size)},
|
||||
{META_WRITTEN, now},
|
||||
});
|
||||
if (res != api_error::success) {
|
||||
utils::error::raise_api_path_error(function_name, get_api_path(), res,
|
||||
"failed to set file meta");
|
||||
return set_api_error(res);
|
||||
}
|
||||
fsi_.size = new_file_size;
|
||||
auto now = std::to_string(utils::time::get_time_now());
|
||||
res = provider_.set_item_meta(fsi_.api_path,
|
||||
{
|
||||
{META_CHANGED, now},
|
||||
{META_MODIFIED, now},
|
||||
{META_SIZE, std::to_string(new_file_size)},
|
||||
{META_WRITTEN, now},
|
||||
});
|
||||
if (res == api_error::success) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
utils::error::raise_api_path_error(function_name, get_api_path(), res,
|
||||
"failed to set file meta");
|
||||
return set_api_error(res);
|
||||
}
|
||||
|
||||
auto open_file::read(std::size_t read_size, std::uint64_t read_offset,
|
||||
|
Reference in New Issue
Block a user