diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-05-15 16:50:11 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-05-15 16:50:11 -0400 |
commit | 746c6aae3f4a2f80c730575bd6eca370efe58f2e (patch) | |
tree | b03fa431442b3d9376068d431246ea6a62120810 /src/libcmd/installable-value.cc | |
parent | 2524a2118647a4125dcae08fe0eb20de5f79a291 (diff) | |
parent | f8a6a9e47314acebea2d72c0ec195360eb58bbec (diff) |
Merge remote-tracking branch 'upstream/master' into best-effort-supplementary-groups
Diffstat (limited to 'src/libcmd/installable-value.cc')
-rw-r--r-- | src/libcmd/installable-value.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libcmd/installable-value.cc b/src/libcmd/installable-value.cc index 3a7ede4e2..1eff293cc 100644 --- a/src/libcmd/installable-value.cc +++ b/src/libcmd/installable-value.cc @@ -41,4 +41,26 @@ ref<InstallableValue> InstallableValue::require(ref<Installable> installable) return ref { castedInstallable }; } +std::optional<DerivedPathWithInfo> InstallableValue::trySinglePathToDerivedPaths(Value & v, const PosIdx pos, std::string_view errorCtx) +{ + if (v.type() == nPath) { + auto storePath = v.path().fetchToStore(state->store); + return {{ + .path = DerivedPath::Opaque { + .path = std::move(storePath), + }, + .info = make_ref<ExtraPathInfo>(), + }}; + } + + else if (v.type() == nString) { + return {{ + .path = state->coerceToDerivedPath(pos, v, errorCtx), + .info = make_ref<ExtraPathInfo>(), + }}; + } + + else return std::nullopt; +} + } |