48 | @@ -49,15 +49,21 @@ static bool IsBerkeleyBtree(const fs::path& path)
49 | return data == 0x00053162 || data == 0x62310500;
50 | }
51 |
52 | +static fs::path LexicallyRelative(const fs::path& path, const fs::path& base)
53 | +{
54 | + assert(path.string().compare(0, base.string().size(), base.string()) == 0);
I don't like using assert as error handling here
I don't like using assert as error handling here
I previously suggested an exception instead of aborting (https://github.com/bitcoin/bitcoin/pull/14561#pullrequestreview-167964007), but this isn't runtime error handling. It is checking an assumption the list code is making about the behavior of recursive_directory_iterator. In the new version of this PR that drops the assert, the assumption is no longer documented or checked, and if it's violated ListWalletDirs will return garbage instead of aborting.