file db unit tests and fixes

This commit is contained in:
Scott E. Graves 2024-12-18 08:59:14 -06:00
parent 7fa51e906c
commit 8c8d7b3bf9

View File

@ -829,9 +829,6 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
db_ = create_file_db(config_);
auto cfg = config_.get_encrypt_config();
auto cfg_path = utils::path::absolute(cfg.path);
std::string source_path;
auto result = db_->get_directory_source_path("/", source_path);
if (result != api_error::success &&
@ -840,6 +837,7 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
fmt::format("failed to get root|{}", api_error_to_string(result)));
}
auto cfg_path = utils::path::absolute(config_.get_encrypt_config().path);
if (result == api_error::success) {
auto cur_path = utils::path::absolute(source_path);
#if defined(_WIN32)
@ -849,10 +847,10 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
if (cur_path != cfg_path) {
#endif // defined(_WIN32)
throw startup_exception(fmt::format(
"source path has changed|cur|{}|cfg|{}", cur_path, cfg.path));
"source path has changed|cur|{}|cfg|{}", cur_path, cfg_path));
}
} else {
result = db_->add_directory("/", utils::path::absolute(source_path));
result = db_->add_directory("/", utils::path::absolute(cfg_path));
if (result != api_error::success) {
throw startup_exception(
fmt::format("failed to create root|{}", api_error_to_string(result)));