Bitcoin Core  0.20.99
P2P Digital Currency
db.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include <fs.h>
7 #include <wallet/db.h>
8 
9 #include <string>
10 
11 void SplitWalletPath(const fs::path& wallet_path, fs::path& env_directory, std::string& database_filename)
12 {
13  if (fs::is_regular_file(wallet_path)) {
14  // Special case for backwards compatibility: if wallet path points to an
15  // existing file, treat it as the path to a BDB data file in a parent
16  // directory that also contains BDB log files.
17  env_directory = wallet_path.parent_path();
18  database_filename = wallet_path.filename().string();
19  } else {
20  // Normal case: Interpret wallet path as a directory path containing
21  // data and log files.
22  env_directory = wallet_path;
23  database_filename = "wallet.dat";
24  }
25 }
void SplitWalletPath(const fs::path &wallet_path, fs::path &env_directory, std::string &database_filename)
Definition: db.cpp:11