changeset 1484:7d3b47852a7a

Print the path to the configuration file being used if `-v` is passed.
author Frits van Bommel <fvbommel wxs.nl>
date Sun, 07 Jun 2009 17:20:55 +0200
parents defafbabbe32
children 9344fecd24f0
files gen/configfile.cpp gen/configfile.h gen/main.cpp
diffstat 3 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gen/configfile.cpp	Sun Jun 07 16:00:13 2009 +0200
+++ b/gen/configfile.cpp	Sun Jun 07 17:20:55 2009 +0200
@@ -89,6 +89,9 @@
         }
     }
 
+    // save config file path for -v output
+    pathstr = p.toString();
+
     try
     {
         // read the cfg
--- a/gen/configfile.h	Sun Jun 07 16:00:13 2009 +0200
+++ b/gen/configfile.h	Sun Jun 07 17:20:55 2009 +0200
@@ -2,6 +2,7 @@
 #define LDC_CONF_CONFIGFILE_H
 
 #include <vector>
+#include <string>
 
 namespace libconfig
 {
@@ -23,8 +24,11 @@
     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;
 };
--- a/gen/main.cpp	Sun Jun 07 16:00:13 2009 +0200
+++ b/gen/main.cpp	Sun Jun 07 17:20:55 2009 +0200
@@ -204,6 +204,13 @@
     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;