Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1334:7c6dcb98ac35 | 1337:b6e819244062 |
---|---|
86 { | 86 { |
87 libconfig::Setting& arr = cfg->lookup("default.switches"); | 87 libconfig::Setting& arr = cfg->lookup("default.switches"); |
88 int len = arr.getLength(); | 88 int len = arr.getLength(); |
89 for (int i=0; i<len; i++) | 89 for (int i=0; i<len; i++) |
90 { | 90 { |
91 const char* v = arr[i]; | 91 std::string v = arr[i]; |
92 switches.push_back(v); | 92 |
93 // replace binpathkey with binpath | |
94 std::string binpathkey = "%%ldcbinarypath%%"; | |
95 sys::Path binpathgetter = sys::Path::GetMainExecutable(argv0, mainAddr); | |
96 binpathgetter.eraseComponent(); | |
97 std::string binpath = binpathgetter.toString(); | |
98 size_t p; | |
99 while (std::string::npos != (p = v.find(binpathkey))) | |
100 v.replace(p, binpathkey.size(), binpath); | |
101 switches.push_back(strdup(v.c_str())); | |
93 } | 102 } |
94 } | 103 } |
95 | 104 |
96 } | 105 } |
97 catch(libconfig::FileIOException& fioe) | 106 catch(libconfig::FileIOException& fioe) |