@@ -4348,19 +4348,29 @@ bool CWallet::InitLoadWallet()
4348
4348
return true ;
4349
4349
}
4350
4350
4351
- std::string walletFile = gArgs .GetArg (" -wallet" , DEFAULT_WALLET_DAT);
4351
+ gArgs .SoftSetArg (" -wallet" , DEFAULT_WALLET_DAT);
4352
4352
4353
- if (walletFile.find_first_of (" /\\ " ) != std::string::npos) {
4354
- return UIError (_ (" -wallet parameter must only specify a filename (not a path)" ));
4355
- } else if (SanitizeString (walletFile, SAFE_CHARS_FILENAME) != walletFile) {
4356
- return UIError (_ (" Invalid characters in -wallet filename" ));
4357
- }
4353
+ for (const std::string& walletFile : gArgs .GetArgs (" -wallet" )) {
4354
+ if (fs::path (walletFile).filename () != walletFile) {
4355
+ return UIError (_ (" -wallet parameter must only specify a filename (not a path)" ));
4356
+ } else if (SanitizeString (walletFile, SAFE_CHARS_FILENAME) != walletFile) {
4357
+ return UIError (_ (" Invalid characters in -wallet filename" ));
4358
+ }
4358
4359
4359
- CWallet * const pwallet = CreateWalletFromFile (walletFile);
4360
- if (!pwallet) {
4361
- return false ;
4360
+ // automatic backups
4361
+ std::string strWarning, strError;
4362
+ if (!AutoBackupWallet (walletFile, strWarning, strError)) {
4363
+ if (!strWarning.empty ()) UIWarning (strWarning);
4364
+ if (!strError.empty ()) return UIError (strError);
4365
+ }
4366
+
4367
+ CWallet * const pwallet = CreateWalletFromFile (walletFile);
4368
+ if (!pwallet) {
4369
+ return false ;
4370
+ }
4371
+ vpwallets.emplace_back (pwallet);
4362
4372
}
4363
- vpwallets. emplace_back (pwallet);
4373
+
4364
4374
return true ;
4365
4375
}
4366
4376
@@ -4885,19 +4895,3 @@ CStakeableOutput::CStakeableOutput(const CWalletTx* txIn, int iIn, int nDepthIn,
4885
4895
const CBlockIndex*& _pindex) : COutput(txIn, iIn, nDepthIn, fSpendableIn , fSolvableIn ),
4886
4896
pindex(_pindex) {}
4887
4897
4888
- bool InitAutoBackupWallet ()
4889
- {
4890
- if (gArgs .GetBoolArg (" -disablewallet" , DEFAULT_DISABLE_WALLET)) {
4891
- return true ;
4892
- }
4893
-
4894
- std::string strWalletFile = gArgs .GetArg (" -wallet" , DEFAULT_WALLET_DAT);
4895
-
4896
- std::string strWarning, strError;
4897
- if (!AutoBackupWallet (strWalletFile, strWarning, strError)) {
4898
- if (!strWarning.empty ()) UIWarning (strWarning);
4899
- if (!strError.empty ()) return UIError (strError);
4900
- }
4901
-
4902
- return true ;
4903
- }
0 commit comments