2010-08-29 18:58:15 +02:00
|
|
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
2015-12-13 14:51:43 +01:00
|
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2012-05-18 16:02:28 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2010-08-29 18:58:15 +02:00
|
|
|
|
2022-03-03 19:37:45 +01:00
|
|
|
#include <fs.h>
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <wallet/db.h>
|
2013-04-13 07:13:08 +02:00
|
|
|
|
2022-03-03 19:37:45 +01:00
|
|
|
void SplitWalletPath(const fs::path& wallet_path, fs::path& env_directory, std::string& database_filename)
|
2018-03-07 17:05:08 +01:00
|
|
|
{
|
|
|
|
if (fs::is_regular_file(wallet_path)) {
|
|
|
|
// Special case for backwards compatibility: if wallet path points to an
|
|
|
|
// existing file, treat it as the path to a BDB data file in a parent
|
|
|
|
// directory that also contains BDB log files.
|
|
|
|
env_directory = wallet_path.parent_path();
|
|
|
|
database_filename = wallet_path.filename().string();
|
|
|
|
} else {
|
|
|
|
// Normal case: Interpret wallet path as a directory path containing
|
|
|
|
// data and log files.
|
|
|
|
env_directory = wallet_path;
|
|
|
|
database_filename = "wallet.dat";
|
|
|
|
}
|
2018-11-20 15:15:51 +01:00
|
|
|
}
|