Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
db.cpp
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 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 <util/fs.h>
7#include <wallet/db.h>
8
9#include <string>
10
12 std::string &database_filename) {
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();
19 } else {
20 // Normal case: Interpret wallet path as a directory path containing
21 // data and log files.
23 database_filename = "wallet.dat";
24 }
25}
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition fs.h:30
static std::string PathToString(const path &path)
Convert path object to byte string.
Definition fs.h:142
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
void SplitWalletPath(const fs::path &wallet_path, fs::path &env_directory, std::string &database_filename)
Definition db.cpp:11