Line data Source code
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 1966 : void SplitWalletPath(const fs::path& wallet_path, fs::path& env_directory, std::string& database_filename) 12 : { 13 1966 : 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 107 : env_directory = wallet_path.parent_path(); 18 107 : database_filename = wallet_path.filename().string(); 19 107 : } else { 20 : // Normal case: Interpret wallet path as a directory path containing 21 : // data and log files. 22 1859 : env_directory = wallet_path; 23 1859 : database_filename = "wallet.dat"; 24 : } 25 1966 : }