From b428adc267f23441be2f801239641aaf8419e4ba Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 25 Aug 2008 13:31:57 +0000 Subject: * Strip off the `.nix' suffix from the attribute name for files in ~/.nix-defexpr, otherwise the attribute cannot be selected with the `-A' option. Useful if you want to stick a Nix expression directly in ~/.nix-defexpr. --- src/libstore/derivations.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index 3456a5f714a0..d0f836cab3d9 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -2,6 +2,7 @@ #include "store-api.hh" #include "aterm.hh" #include "globals.hh" +#include "util.hh" #include "derivations-ast.hh" #include "derivations-ast.cc" @@ -163,9 +164,7 @@ ATerm unparseDerivation(const Derivation & drv) bool isDerivation(const string & fileName) { - return - fileName.size() >= drvExtension.size() && - string(fileName, fileName.size() - drvExtension.size()) == drvExtension; + return hasSuffix(fileName, drvExtension); } -- cgit 1.4.1