refactor
This commit is contained in:
@ -171,19 +171,18 @@ auto encrypt_provider::get_directory_item_count(
|
||||
|
||||
std::uint64_t count{};
|
||||
auto res{
|
||||
do_fs_operation(
|
||||
api_path, true,
|
||||
[&api_path, &count](const encrypt_config & /* cfg */,
|
||||
const std::string &source_path) -> api_error {
|
||||
try {
|
||||
count = utils::file::directory{source_path}.count();
|
||||
} catch (const std::exception &ex) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, api_path, source_path, ex,
|
||||
"failed to get directory item count");
|
||||
}
|
||||
return api_error::success;
|
||||
}),
|
||||
do_fs_operation(api_path, true,
|
||||
[&api_path, &count](auto && /* cfg */,
|
||||
auto &&source_path) -> api_error {
|
||||
try {
|
||||
count = utils::file::directory{source_path}.count();
|
||||
} catch (const std::exception &ex) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, api_path, source_path, ex,
|
||||
"failed to get directory item count");
|
||||
}
|
||||
return api_error::success;
|
||||
}),
|
||||
};
|
||||
if (res != api_error::success) {
|
||||
utils::error::raise_api_path_error(function_name, api_path, res,
|
||||
@ -200,8 +199,7 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
||||
|
||||
return do_fs_operation(
|
||||
api_path, true,
|
||||
[this, &list](const encrypt_config &cfg,
|
||||
const std::string &source_path) -> api_error {
|
||||
[this, &list](auto &&cfg, auto &&source_path) -> api_error {
|
||||
try {
|
||||
for (const auto &dir_entry :
|
||||
utils::file::directory{source_path}.get_items()) {
|
||||
@ -334,9 +332,9 @@ auto encrypt_provider::get_file_list(api_file_list &list,
|
||||
-> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
try {
|
||||
const auto &cfg{get_encrypt_config()};
|
||||
const auto &cfg{get_encrypt_config()};
|
||||
|
||||
try {
|
||||
for (const auto &dir_entry : utils::file::directory{cfg.path}.get_items()) {
|
||||
std::string api_path{};
|
||||
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
|
||||
|
Reference in New Issue
Block a user