fix: referencing files in cwd without dot slash

This commit is contained in:
Jan 2024-08-21 10:41:15 +02:00
parent 31d93d39a4
commit 42a3e207e5
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
2 changed files with 8 additions and 2 deletions

View File

@ -543,7 +543,10 @@ class LinkerImpl final : public Linker
return false; return false;
} }
auto absoluteZoneDirectory = absolute(std::filesystem::path(zonePath).remove_filename()).string(); auto zoneDirectory = fs::path(zonePath).remove_filename();
if (zoneDirectory.empty())
zoneDirectory = fs::current_path();
auto absoluteZoneDirectory = absolute(zoneDirectory).string();
auto zone = std::unique_ptr<Zone>(ZoneLoading::LoadZone(zonePath)); auto zone = std::unique_ptr<Zone>(ZoneLoading::LoadZone(zonePath));
if (zone == nullptr) if (zone == nullptr)

View File

@ -381,7 +381,10 @@ class Unlinker::Impl
continue; continue;
} }
auto absoluteZoneDirectory = absolute(std::filesystem::path(zonePath).remove_filename()).string(); auto zoneDirectory = fs::path(zonePath).remove_filename();
if (zoneDirectory.empty())
zoneDirectory = fs::current_path();
auto absoluteZoneDirectory = absolute(zoneDirectory).string();
auto searchPathsForZone = GetSearchPathsForZone(absoluteZoneDirectory); auto searchPathsForZone = GetSearchPathsForZone(absoluteZoneDirectory);
searchPathsForZone.IncludeSearchPath(&m_search_paths); searchPathsForZone.IncludeSearchPath(&m_search_paths);