extract common behavior
All checks were successful
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good

This commit is contained in:
2023-11-12 12:36:44 -06:00
parent 560ffbbb6a
commit 8360d9e045
6 changed files with 25 additions and 50 deletions

View File

@ -146,6 +146,27 @@ auto base_provider::get_api_path_from_source(const std::string &source_path,
return api_error::item_not_found;
}
auto base_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 base_provider::get_filesystem_item(const std::string &api_path,
bool directory,
filesystem_item &fsi) const