diff --git a/src/rpc/protocol.cpp b/src/rpc/protocol.cpp index 53001e959fc..527510b9397 100644 --- a/src/rpc/protocol.cpp +++ b/src/rpc/protocol.cpp @@ -73,7 +73,7 @@ static const std::string COOKIEAUTH_FILE = ".cookie"; fs::path GetAuthCookieFile() { fs::path path(GetArg("-rpccookiefile", COOKIEAUTH_FILE)); - if (!path.is_complete()) path = GetDataDir() / path; + if (!path.is_absolute()) path = GetDataDir() / path; return path; } diff --git a/src/util.cpp b/src/util.cpp index 0f7a4db7a46..0aa22af853c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -588,7 +588,7 @@ const fs::path &GetBackupDir() fs::path GetConfigFile(const std::string& confPath) { fs::path pathConfigFile(confPath); - if (!pathConfigFile.is_complete()) + if (!pathConfigFile.is_absolute()) pathConfigFile = GetDataDir(false) / pathConfigFile; return pathConfigFile; @@ -624,7 +624,7 @@ void ReadConfigFile(const std::string& confPath) fs::path GetPidFile() { fs::path pathPidFile(GetArg("-pid", BITCOIN_PID_FILENAME)); - if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile; + if (!pathPidFile.is_absolute()) pathPidFile = GetDataDir() / pathPidFile; return pathPidFile; } diff --git a/src/validation.h b/src/validation.h index 3ea29a0b9d1..21e94af8bb4 100644 --- a/src/validation.h +++ b/src/validation.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 58f69aa96e3..524e44fa422 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -459,8 +459,10 @@ bool CWallet::Verify() uiInterface.InitMessage(_("Verifying wallet...")); // Wallet file must be a plain filename without a directory - if (walletFile != fs::basename(walletFile) + fs::extension(walletFile)) + fs::path walletPath(walletFile); + if (walletFile != walletPath.stem().string() + walletPath.extension().string()) { return InitError(strprintf(_("Wallet %s resides outside data directory %s"), walletFile, GetDataDir().string())); + } if (!bitdb.Open(GetDataDir())) { @@ -4019,7 +4021,11 @@ bool CWallet::BackupWallet(const std::string& strDest) return false; } -#if BOOST_VERSION >= 104000 +#if BOOST_VERSION >= 107400 + // Boost 1.74.0 and up implements std++17 like "copy_options", and this + // is the only remaining enum after 1.85.0 + fs::copy_file(pathSrc, pathDest, fs::copy_options::overwrite_existing); +#elif BOOST_VERSION >= 104000 fs::copy_file(pathSrc, pathDest, fs::copy_option::overwrite_if_exists); #else fs::copy_file(pathSrc, pathDest);