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

Encode virtual paths as /nix/store/virtual000<N>

This makes lib.isStorePath in nixpkgs return true for source trees and
fixes some cases where /__nix_virtual__ showed up in the NixOS manual.
This commit is contained in:
Eelco Dolstra 2022-10-27 15:57:56 +02:00
parent e424a8b196
commit a653e98f55
4 changed files with 19 additions and 10 deletions

View file

@ -227,14 +227,16 @@ public:
void registerAccessor(ref<InputAccessor> accessor);
/* Convert a path to a string representation of the format
`/__nix_virtual__/<accessor-number>/<path>`. */
`/nix/store/virtual000...<accessor-number>/<path>`. */
std::string encodePath(const SourcePath & path);
/* Decode a path encoded by `encodePath()`. */
SourcePath decodePath(std::string_view s, PosIdx pos = noPos);
const std::string virtualPathMarker;
/* Decode all virtual paths in a string, i.e. all
/__nix_virtual__/... substrings are replaced by the
/nix/store/virtual000... substrings are replaced by the
corresponding input accessor. */
std::string decodePaths(std::string_view s);