1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 06:11:46 +02:00

Add CanonPath wrapper to represent canonicalized paths

This commit is contained in:
Eelco Dolstra 2022-05-16 23:27:04 +02:00
parent de35e2d3b4
commit a71f209330
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
31 changed files with 503 additions and 187 deletions

View file

@ -94,8 +94,8 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s)
if (isUri(s)) {
auto storePath = fetchers::downloadTarball(
state.store, resolveUri(s), "source", false).first.storePath;
auto & accessor = state.registerAccessor(makeFSInputAccessor(state.store->toRealPath(storePath)));
return {accessor, "/"};
auto & accessor = state.registerAccessor(makeFSInputAccessor(CanonPath(state.store->toRealPath(storePath))));
return {accessor, CanonPath::root};
} else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
Path p(s.substr(1, s.size() - 2));
return state.findFile(p);