diff --git a/repertory/librepertory/src/providers/encrypt/encrypt_provider.cpp b/repertory/librepertory/src/providers/encrypt/encrypt_provider.cpp index 05f44bf1..8a562855 100644 --- a/repertory/librepertory/src/providers/encrypt/encrypt_provider.cpp +++ b/repertory/librepertory/src/providers/encrypt/encrypt_provider.cpp @@ -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)));