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.
This commit is contained in:
1 parent
3ace3a17c9
commit
80cd64e842
2 files changed
+1
-4
No files matched your search
@@ -71,12 +71,9 @@ BOOST_AUTO_TEST_CASE(util_datadir)
|
|||||||
args.ClearPathCache();
|
args.ClearPathCache();
|
||||||
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirBase());
|
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirBase());
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
// Windows does not consider "datadir/.//" to be a valid directory path.
|
|
||||||
args.ForceSetArg("-datadir", fs::PathToString(dd_norm) + "/.//");
|
args.ForceSetArg("-datadir", fs::PathToString(dd_norm) + "/.//");
|
||||||
args.ClearPathCache();
|
args.ClearPathCache();
|
||||||
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirBase());
|
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirBase());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(util_check)
|
BOOST_AUTO_TEST_CASE(util_check)
|
||||||
|
|||||||
+1
-1
@@ -253,7 +253,7 @@ fs::path StripRedundantLastElementsOfPath(const fs::path& path)
|
|||||||
result = result.parent_path();
|
result = result.parent_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(fs::equivalent(result, path));
|
assert(fs::equivalent(result, path.lexically_normal()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in new issue
Block a user