This commit is contained in:
2024-08-29 14:47:10 -05:00
parent 272d9a1502
commit 5910ed3dae
2 changed files with 8 additions and 12 deletions

View File

@ -78,18 +78,14 @@ auto encrypt_provider::create_api_file(
} }
api_file file{}; api_file file{};
file.accessed_date = times->get(utils::file::time_type::accessed);
file.api_path = api_path; file.api_path = api_path;
file.api_parent = utils::path::get_parent_api_path(api_path); file.api_parent = utils::path::get_parent_api_path(api_path);
file.file_size =
directory
? 0U
: utils::encryption::encrypting_reader::calculate_encrypted_size(
source_path);
file.source_path = source_path;
file.accessed_date = times->get(utils::file::time_type::accessed);
file.changed_date = times->get(utils::file::time_type::modified); file.changed_date = times->get(utils::file::time_type::modified);
file.creation_date = times->get(utils::file::time_type::created); file.creation_date = times->get(utils::file::time_type::created);
file.file_size = directory ? 0U : utils::encryption::encrypting_reader::calculate_encrypted_size( source_path);
file.modified_date = times->get(utils::file::time_type::written); file.modified_date = times->get(utils::file::time_type::written);
file.source_path = source_path;
return file; return file;
} }

View File

@ -52,7 +52,7 @@ struct file_times final {
return written; return written;
} }
throw std::runtime_error("type_type not supported") : throw std::runtime_error("type_type not supported");
} }
}; };
@ -71,11 +71,11 @@ file_exists_in_path(std::string_view path, std::string_view file_name) -> bool;
file_exists_in_path(std::wstring_view path, file_exists_in_path(std::wstring_view path,
std::wstring_view file_name) -> bool; std::wstring_view file_name) -> bool;
[[nodiscard]] auto get_time(std::string_view path, time_type type) const [[nodiscard]] auto get_time(std::string_view path,
-> std::optional<std::uint64_t>; time_type type) -> std::optional<std::uint64_t>;
[[nodiscard]] auto get_time(std::wstring_view path, time_type type) const [[nodiscard]] auto get_time(std::wstring_view path,
-> std::optional<std::uint64_t>; time_type type) -> std::optional<std::uint64_t>;
[[nodiscard]] auto [[nodiscard]] auto
get_times(std::string_view path) -> std::optional<file_times>; get_times(std::string_view path) -> std::optional<file_times>;