Also consider empty dirs for find_dominating_file

Just in case.
This commit is contained in:
Robbert van der Helm
2022-04-15 14:36:58 +02:00
parent c2de0cce2e
commit b2ffbb8b4d
+1 -1
View File
@@ -304,7 +304,7 @@ std::optional<ghc::filesystem::path> find_dominating_file(
const std::string& filename,
ghc::filesystem::path starting_dir,
F&& predicate = ghc::filesystem::exists) {
while (starting_dir != "/") {
while (starting_dir != "/" && starting_dir != "") {
const ghc::filesystem::path candidate = starting_dir / filename;
if (predicate(candidate)) {
return candidate;