```> Switching to std::filesystems makes possible to leverage std::filesystem::path::lexically_normal and get rid of ugly StripRedundantLastElementsOfPath() crutch.
Switching to std::filesystems makes possible to leverage std::filesystem::path::lexically_normal and get rid of ugly StripRedundantLastElementsOfPath() crutch.>
> To make its usage simple and error-proof, a new ArgsManager::GetPathArg() member function introduced which guarantees to return a normalized with no trailing slashes paths provided via -datadir, -blocksdir or -walletdir command-line arguments or configure options.
Re-enable tests disabled in #20744
To make its usage simple and error-proof,> This should also fix an init error if a -walletdir with a trailing slash
> is used on windows. a new ArgsManager::GetPathArg() member function introduced which guarantees to return a normalized with no trailing slashes paths provided via -datadir, -blocksdir or -walletdir command-line arguments or configure options.This appears to be a real error and regression
> introduced with #20744.
>
```> On windows (or at least wine), fs calls that actuallly access the
> filesystem like fs::equivalent or fs::exists seem to treat directory
> paths with trailing slashes as not existing, so it's necessary to
> normalize these paths before using them. This change passes canonical
> paths to fs calls validating the -walletdir path to fix this.
Backport of [[https://github.com/bitcoin/bitcoin/pull/24265 | core#24265]] and [[https://github.com/bitcoin/bitcoin/pull/24251 | core#24251]].
Depends on D11974.