extract common behavior
This commit is contained in:
@@ -429,27 +429,6 @@ auto sia_provider::get_file_list(api_file_list &list) const -> api_error {
|
||||
return get_files_in_dir("");
|
||||
}
|
||||
|
||||
auto sia_provider::get_file_size(const std::string &api_path,
|
||||
std::uint64_t &file_size) const -> api_error {
|
||||
bool exists{};
|
||||
auto res = is_directory(api_path, exists);
|
||||
if (res != api_error::success) {
|
||||
return res;
|
||||
}
|
||||
if (exists) {
|
||||
return api_error::directory_exists;
|
||||
}
|
||||
|
||||
api_file file{};
|
||||
res = get_file(api_path, file);
|
||||
if (res != api_error::success) {
|
||||
return res;
|
||||
}
|
||||
|
||||
file_size = file.file_size;
|
||||
return api_error::success;
|
||||
}
|
||||
|
||||
auto sia_provider::get_total_drive_space() const -> std::uint64_t {
|
||||
try {
|
||||
curl::requests::http_get get{};
|
||||
|
Reference in New Issue
Block a user