changeset 1337:b6e819244062

In config file: replace %%ldcbinarypath%% with the path to the ldc executable.
author Christian Kamm <kamm incasoftware de>
date Sun, 10 May 2009 17:58:09 +0200
parents 7c6dcb98ac35
children 99ebaa4dd414
files gen/configfile.cpp ldc.conf.in
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gen/configfile.cpp	Sun May 10 15:50:51 2009 +0200
+++ b/gen/configfile.cpp	Sun May 10 17:58:09 2009 +0200
@@ -88,8 +88,17 @@
             int len = arr.getLength();
             for (int i=0; i<len; i++)
             {
-                const char* v = arr[i];
-                switches.push_back(v);
+                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 15:50:51 2009 +0200
+++ b/ldc.conf.in	Sun May 10 17:58:09 2009 +0200
@@ -9,7 +9,7 @@
     switches = [
         "-I@RUNTIME_DIR@",
         "-I@RUNTIME_DIR@/lib/common",
-        "-L-L@PROJECT_BINARY_DIR@/../lib",
+        "-L-L%%ldcbinarydir%%/../lib",
         "-d-version=Tango",
         "-defaultlib=@RUNTIME_AIO@",
         "-debuglib=@RUNTIME_AIO@"