From 784f6d0939dac2db519e49f75d6af2abcbf466b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Thu, 16 Jun 2022 12:52:23 +0200 Subject: [PATCH] wallet: dont try archive if file doesnt exist (#1377) --- .../src-tauri/src/wallet_storage/mod.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/nym-wallet/src-tauri/src/wallet_storage/mod.rs b/nym-wallet/src-tauri/src/wallet_storage/mod.rs index eed3f0ada1..50d2eae135 100644 --- a/nym-wallet/src-tauri/src/wallet_storage/mod.rs +++ b/nym-wallet/src-tauri/src/wallet_storage/mod.rs @@ -308,10 +308,27 @@ fn _archive_wallet_file(path: &Path) -> Result<(), BackendError> { } pub(crate) fn archive_wallet_file() -> Result<(), BackendError> { - log::info!("Archiving wallet file"); let store_dir = get_storage_directory()?; let filepath = store_dir.join(WALLET_INFO_FILENAME); - _archive_wallet_file(&filepath) + + if filepath.exists() { + if let Some(filepath) = filepath.to_str() { + log::info!("Archiving wallet file: {}", filepath); + } else { + log::info!("Archiving wallet file"); + } + _archive_wallet_file(&filepath) + } else { + if let Some(filepath) = filepath.to_str() { + log::info!( + "Skipping archiving wallet file, as it's not found: {}", + filepath + ); + } else { + log::info!("Skipping archiving wallet file, as it's not found"); + } + Err(BackendError::WalletFileNotFound) + } } /// Remove an account from inside the encrypted login.