aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dietz <michael.dietz@waya.ai>2021-10-28 22:03:37 -0500
committerMichael Dietz <michael.dietz@waya.ai>2021-10-29 09:36:32 -0500
commit9ba7c44265a47880585e39d0167d057ba935ff16 (patch)
tree10878331898a85026fff49d5d767837b51a752f2
parentab25ef8c7f767258d5fe44f53b35ad8bd51ed5cd (diff)
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`
-rw-r--r--src/wallet/db.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index c74c69ed09..305f6c31fc 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -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())))) {