Mercurial > projects > ldc
diff gen/configfile.cpp @ 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 | 454f0c8acc4b |
children | 2e98ddd72fa7 |
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())); } }