From 42a3e207e5040c3d481056b6453de7ab5cc29885 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 21 Aug 2024 10:41:15 +0200 Subject: [PATCH] fix: referencing files in cwd without dot slash --- src/Linker/Linker.cpp | 5 ++++- src/Unlinker/Unlinker.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Linker/Linker.cpp b/src/Linker/Linker.cpp index 755e2b8e..e042f288 100644 --- a/src/Linker/Linker.cpp +++ b/src/Linker/Linker.cpp @@ -543,7 +543,10 @@ class LinkerImpl final : public Linker 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(ZoneLoading::LoadZone(zonePath)); if (zone == nullptr) diff --git a/src/Unlinker/Unlinker.cpp b/src/Unlinker/Unlinker.cpp index f26cc12d..7d4b507a 100644 --- a/src/Unlinker/Unlinker.cpp +++ b/src/Unlinker/Unlinker.cpp @@ -381,7 +381,10 @@ class Unlinker::Impl 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); searchPathsForZone.IncludeSearchPath(&m_search_paths);