diff options
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r-- | src/nix-env/nix-env.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 3db84ff5c7b5..2d38f2aea729 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -58,6 +58,7 @@ struct Globals bool removeAll; string forceName; bool prebuiltOnly; + Globals(const Strings & searchPath) : state(searchPath) { } }; @@ -1351,7 +1352,17 @@ void run(Strings args) Strings opFlags, opArgs, remaining; Operation op = 0; - Globals globals; + /* FIXME: hack. */ + Strings searchPath; + Strings args2; + for (Strings::iterator i = args.begin(); i != args.end(); ) { + string arg = *i++; + if (!parseSearchPathArg(arg, i, args.end(), searchPath)) + args2.push_back(arg); + } + args = args2; + + Globals globals(searchPath); globals.instSource.type = srcUnknown; globals.instSource.nixExprPath = getDefNixExprPath(); @@ -1372,8 +1383,6 @@ void run(Strings args) else if (parseOptionArg(arg, i, args.end(), globals.state, globals.instSource.autoArgs)) ; - else if (parseSearchPathArg(arg, i, args.end(), globals.state)) - ; else if (arg == "--force-name") // undocumented flag for nix-install-package globals.forceName = needArg(i, args, arg); else if (arg == "--uninstall" || arg == "-e") |