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