Skip to content

Commit 80cd64e

Browse files
committed
Re-enable util_datadir check disabled in #20744
This should also fix an assert error if a -datadir with a trailing slash is used on windows. 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 fix adds a path::lexically_normal() call to the failing assert so it passes.
1 parent 3ace3a1 commit 80cd64e

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/test/util_tests.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,9 @@ BOOST_AUTO_TEST_CASE(util_datadir)
7171
args.ClearPathCache();
7272
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirBase());
7373

74-
#ifndef WIN32
75-
// Windows does not consider "datadir/.//" to be a valid directory path.
7674
args.ForceSetArg("-datadir", fs::PathToString(dd_norm) + "/.//");
7775
args.ClearPathCache();
7876
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirBase());
79-
#endif
8077
}
8178

8279
BOOST_AUTO_TEST_CASE(util_check)

src/util/system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ fs::path StripRedundantLastElementsOfPath(const fs::path& path)
253253
result = result.parent_path();
254254
}
255255

256-
assert(fs::equivalent(result, path));
256+
assert(fs::equivalent(result, path.lexically_normal()));
257257
return result;
258258
}
259259
} // namespace

0 commit comments

Comments
 (0)