about summary refs log tree commit diff
path: root/src/fix.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-10T13·41+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-10T13·41+0000
commitd072485d2895d01dbbab1d899418726e3349343f (patch)
tree237c23cdb613d363e9205f89d51cac8433cf3b85 /src/fix.cc
parent5d4b90b689b09965be39c69aceddaf0b165598d0 (diff)
* Get `nix-push' working again. It now uses Nix/Fix to create Nix
  archives (using the package in corepkgs/nar).
* queryPathByHash -> expandHash, and it takes an argument specifying
  the target path (which may be empty).
* Install the core Fix packages in $prefix/share/fix.  TODO: bootstrap
  Nix and install Nix as a Fix package.

Diffstat (limited to 'src/fix.cc')
-rw-r--r--src/fix.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fix.cc b/src/fix.cc
index 9e5b8b5d416a..5c4297bfb760 100644
--- a/src/fix.cc
+++ b/src/fix.cc
@@ -15,6 +15,8 @@ static Strings searchDirs;
 
 static string searchPath(string relPath)
 {
+    if (string(relPath, 0, 1) == "/") return relPath;
+
     for (Strings::iterator i = searchDirs.begin();
          i != searchDirs.end(); i++)
     {
@@ -218,7 +220,10 @@ static Expr evalExpr(Expr e)
 
 static Expr evalFile(string relPath)
 {
-    Expr e = ATreadFromNamedFile(searchPath(relPath).c_str());
+    string path = searchPath(relPath);
+    Expr e = ATreadFromNamedFile(path.c_str());
+    if (!e) 
+        throw Error(format("unable to read a term from `%1%'") % path);
     return evalExpr(e);
 }
 
@@ -228,6 +233,7 @@ void run(Strings args)
     Strings files;
 
     searchDirs.push_back(".");
+    searchDirs.push_back(nixDataDir + "/fix");
     
     for (Strings::iterator it = args.begin();
          it != args.end(); )