From 54bf5ba4227a234f8cd5102634b9a3b535e6fbdb Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 16 Dec 2019 19:11:47 +0100 Subject: nix-store -r: Handle symlinks to store paths Fixes #3270. --- src/libstore/path.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libstore/path.cc') diff --git a/src/libstore/path.cc b/src/libstore/path.cc index 81ae495a1..cda5f9968 100644 --- a/src/libstore/path.cc +++ b/src/libstore/path.cc @@ -96,4 +96,19 @@ StorePathSet singleton(const StorePath & path) return res; } +std::pair parsePathWithOutputs(std::string_view s) +{ + size_t n = s.find("!"); + return n == s.npos + ? std::make_pair(s, std::set()) + : std::make_pair(((std::string_view) s).substr(0, n), + tokenizeString>(((std::string_view) s).substr(n + 1), ",")); +} + +StorePathWithOutputs Store::parsePathWithOutputs(const std::string & s) +{ + auto [path, outputs] = nix::parsePathWithOutputs(s); + return {parseStorePath(path), std::move(outputs)}; +} + } -- cgit v1.2.3