mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Merge bitcoin/bitcoin#23385: refactor: get wallet path relative to wallet_dir
9ba7c44265
refactor: get wallet path relative to wallet_dir (Michael Dietz) Pull request description: Now that boost has been updated > 1.60 (see #22320), we can simplify how we get wallet path relative to wallet_dir by using: `boost::filesystem::lexically_relative`, removing a TODO. Test coverage comes from `test/functional/wallet_multiwallet.py` I first tried this in #20265 which was my first attempted PR, and funny enough exactly 1 year later I'm opening this one to hopefully finally close this. ACKs for top commit: ryanofsky: Code review ACK9ba7c44265
. Basically this same code change is made in #20744 commit b70c84348ac7a8e427a1183f894c73e52c734529, so this PR helps simplify that one lsilva01: Code Review ACK9ba7c44
Tree-SHA512: 6ccb91a18bcb52c3ae0c789a94a18fb5be7db7769fd1121552d63f259fbd32b50c3dcf169cec0b02f978321db3bc60eb4b881b8327e9764f32e700236e0d8a35
This commit is contained in:
commit
7efc628539
1 changed files with 1 additions and 5 deletions
|
@ -12,7 +12,6 @@
|
|||
|
||||
std::vector<fs::path> ListDatabases(const fs::path& wallet_dir)
|
||||
{
|
||||
const size_t offset = wallet_dir.native().size() + (wallet_dir == wallet_dir.root_name() ? 0 : 1);
|
||||
std::vector<fs::path> paths;
|
||||
boost::system::error_code ec;
|
||||
|
||||
|
@ -28,10 +27,7 @@ std::vector<fs::path> ListDatabases(const fs::path& wallet_dir)
|
|||
}
|
||||
|
||||
try {
|
||||
// Get wallet path relative to walletdir by removing walletdir from the wallet path.
|
||||
// This can be replaced by boost::filesystem::lexically_relative once boost is bumped to 1.60.
|
||||
const auto path_str = it->path().native().substr(offset);
|
||||
const fs::path path{path_str.begin(), path_str.end()};
|
||||
const fs::path path{it->path().lexically_relative(wallet_dir)};
|
||||
|
||||
if (it->status().type() == fs::directory_file &&
|
||||
(IsBDBFile(BDBDataFile(it->path())) || IsSQLiteFile(SQLiteDataFile(it->path())))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue