Print the path to the configuration file being used if -v is passed.

This commit is contained in:
Frits van Bommel
2009-06-07 17:20:55 +02:00
parent 96650855ed
commit f76870f255
3 changed files with 14 additions and 0 deletions

View File

@@ -89,6 +89,9 @@ bool ConfigFile::read(const char* argv0, void* mainAddr, const char* filename)
}
}
// save config file path for -v output
pathstr = p.toString();
try
{
// read the cfg

View File

@@ -2,6 +2,7 @@
#define LDC_CONF_CONFIGFILE_H
#include <vector>
#include <string>
namespace libconfig
{
@@ -23,8 +24,11 @@ public:
s_iterator switches_begin() { return switches.begin(); }
s_iterator switches_end() { return switches.end(); }
const std::string& path() { return pathstr; }
private:
libconfig::Config* cfg;
std::string pathstr;
s_vector switches;
};

View File

@@ -204,6 +204,13 @@ int main(int argc, char** argv)
cl::SetVersionPrinter(&printVersion);
cl::ParseCommandLineOptions(final_args.size(), (char**)&final_args[0], "LLVM-based D Compiler\n", true);
// Print config file path if -v was passed
if (global.params.verbose) {
const std::string& path = cfg_file.path();
if (!path.empty())
printf("config %s\n", path.c_str());
}
// Negated options
global.params.link = !compileOnly;
global.params.obj = !dontWriteObj;