aboutsummaryrefslogtreecommitdiff
path: root/src/nix/bundle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/bundle.cc')
-rw-r--r--src/nix/bundle.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc
index 677d42520..95aed5269 100644
--- a/src/nix/bundle.cc
+++ b/src/nix/bundle.cc
@@ -9,7 +9,7 @@ using namespace nix;
struct CmdBundle : InstallableCommand
{
std::string bundler = "github:matthewbauer/nix-bundle";
- Path outLink;
+ std::optional<Path> outLink;
CmdBundle()
{
@@ -92,18 +92,18 @@ struct CmdBundle : InstallableCommand
if (!evalState->isDerivation(*vRes))
throw Error("the bundler '%s' does not produce a derivation", bundler.what());
- Bindings::iterator i = vRes->attrs->find(evalState->sDrvPath);
- if (i == vRes->attrs->end())
- throw Error("the bundler '%s' does not produce a bderivation", bundler.what());
+ auto attr1 = vRes->attrs->find(evalState->sDrvPath);
+ if (!attr1)
+ throw Error("the bundler '%s' does not produce a derivation", bundler.what());
PathSet context2;
- StorePath drvPath = store->parseStorePath(evalState->coerceToPath(*i->pos, *i->value, context2));
+ StorePath drvPath = store->parseStorePath(evalState->coerceToPath(*attr1->pos, *attr1->value, context2));
- i = vRes->attrs->find(evalState->sOutPath);
- if (i == vRes->attrs->end())
+ auto attr2 = vRes->attrs->find(evalState->sOutPath);
+ if (!attr2)
throw Error("the bundler '%s' does not produce a derivation", bundler.what());
- StorePath outPath = store->parseStorePath(evalState->coerceToPath(*i->pos, *i->value, context2));
+ StorePath outPath = store->parseStorePath(evalState->coerceToPath(*attr2->pos, *attr2->value, context2));
store->buildPaths({{drvPath}});
@@ -113,10 +113,10 @@ struct CmdBundle : InstallableCommand
if (!info->references.empty())
throw Error("'%s' has references; a bundler must not leave any references", outPathS);
- if (outLink == "")
+ if (!outLink)
outLink = baseNameOf(app.program);
- store.dynamic_pointer_cast<LocalFSStore>()->addPermRoot(outPath, absPath(outLink), true);
+ store.dynamic_pointer_cast<LocalFSStore>()->addPermRoot(outPath, absPath(*outLink), true);
}
};