Skip to content

Commit

Permalink
Merge pull request Laupetin#236 from Laupetin/fix/current-dir-prefix
Browse files Browse the repository at this point in the history
fix: referencing files in cwd without dot slash
  • Loading branch information
Laupetin authored Aug 21, 2024
2 parents 31d93d3 + 42a3e20 commit 805e1a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Linker/Linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Zone>(ZoneLoading::LoadZone(zonePath));
if (zone == nullptr)
Expand Down
5 changes: 4 additions & 1 deletion src/Unlinker/Unlinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 805e1a2

Please sign in to comment.