mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
refactor: get wallet path relative to wallet_dir
Now that boost has been updated > 1.60, we can simplify how we get wallet path relative to wallet_dir by using: `boost::filesystem::lexically_relative`
This commit is contained in:
parent
ab25ef8c7f
commit
9ba7c44265
@ -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…
Reference in New Issue
Block a user