about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-10-17T12·58+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-10-17T12·58+0000
commit58ff6939f4713063dabd77d485689691a82dbb3b (patch)
tree2472972b79fda72768c751b7e80c3b47e332a517 /src
parent3059df0f1e7c70da8b63e09420af84014ef96295 (diff)
* An awful backwards compatibility hack.
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index df8be08c60d0..31e9c462f365 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -557,6 +557,30 @@ Expr evalExpr2(EvalState & state, Expr e)
     if (matchOpPlus(e, e1, e2) || matchConcatStrings(e, es)) {
         ATermVector args;
         if (matchOpPlus(e, e1, e2)) {
+
+            /* !!! Awful compatibility hack for `drv + /path'.
+               According to regular concatenation, /path should be
+               copied to the store and its store path should be
+               appended to the string.  However, in Nix <= 0.10, /path
+               was concatenated.  So handle that case separately, but
+               do print out a warning.  This code can go in Nix 0.12,
+               maybe. */
+            e1 = evalExpr(state, e1);
+            e2 = evalExpr(state, e2);
+
+            ATermList as;
+            ATerm p;
+            if (matchAttrs(e1, as) && matchPath(e2, p)) {
+                static bool haveWarned = false;
+                warnOnce(haveWarned,
+                    "concatenation of a derivation and a path is deprecated, "
+                    "you should write `drv + \"/path\"' instead of `drv + /path'");
+                PathSet context;
+                return makeStr(
+                    coerceToString(state, makeSelect(e1, toATerm("outPath")), context)
+                    + aterm2String(p), context);
+            }
+
             args.push_back(e1);
             args.push_back(e2);
         } else