changeset 1340:206329112670

Fix the ldcbinarypath config file rewriting.
author Christian Kamm <kamm incasoftware de>
date Sun, 10 May 2009 18:14:36 +0200
parents 2e98ddd72fa7
children 681dd955c53b
files gen/configfile.cpp ldc.conf.in
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gen/configfile.cpp	Sun May 10 18:03:32 2009 +0200
+++ b/gen/configfile.cpp	Sun May 10 18:14:36 2009 +0200
@@ -1,7 +1,7 @@
 #include <iostream>
 #include <string>
 #include <cassert>
-#include <string.h>
+#include <cstring>
 
 #include "llvm/System/Path.h"
 
@@ -85,6 +85,9 @@
         // handle switches
         if (root.exists("switches"))
         {
+            std::string binpathkey = "%%ldcbinarypath%%";
+            std::string binpath = sys::Path::GetMainExecutable(argv0, mainAddr).getDirname();
+
             libconfig::Setting& arr = cfg->lookup("default.switches");
             int len = arr.getLength();
             for (int i=0; i<len; i++)
@@ -92,13 +95,10 @@
                 std::string v = arr[i];
                 
                 // replace binpathkey with binpath
-                std::string binpathkey = "%%ldcbinarypath%%";
-                sys::Path binpathgetter = sys::Path::GetMainExecutable(argv0, mainAddr);
-                binpathgetter.eraseComponent();
-                std::string binpath = binpathgetter.toString();
                 size_t p;
                 while (std::string::npos != (p = v.find(binpathkey)))
                     v.replace(p, binpathkey.size(), binpath);
+                
                 switches.push_back(strdup(v.c_str()));
             }
         }
--- a/ldc.conf.in	Sun May 10 18:03:32 2009 +0200
+++ b/ldc.conf.in	Sun May 10 18:14:36 2009 +0200
@@ -9,7 +9,7 @@
     switches = [
         "-I@RUNTIME_DIR@",
         "-I@RUNTIME_DIR@/lib/common",
-        "-L-L%%ldcbinarydir%%/../lib",
+        "-L-L%%ldcbinarypath%%/../lib",
         "-d-version=Tango",
         "-defaultlib=@RUNTIME_AIO@",
         "-debuglib=@RUNTIME_AIO@"