]> Dogcows Code - chaz/yoink/blobdiff - src/MainLayer.cc
small build system tweaks
[chaz/yoink] / src / MainLayer.cc
index c5a93864a57f24e34cbfa1df103409d10ae1864b..2e687855dd73d03a557bcf2108d9940d1706ed4c 100644 (file)
@@ -29,6 +29,7 @@
 #include <cstdlib>             // atexit, getenv
 #include <iostream>
 #include <string>
+#include <unistd.h>            // access
 
 #include <Moof/Dispatcher.hh>
 #include <Moof/Exception.hh>
@@ -189,14 +190,39 @@ void printUsage()
                          << "See documentation for more options." << std::endl;
 }
 
-void printInfo()
+void printInfo(int argc, char* argv[])
 {
-       std::cout << PACKAGE_STRING << std::endl
+       std::string assets;
+       std::string datadir;
+       std::string config;
+
+       assets.assign(YOINK_DATADIR);
+       int accessible = access(assets.c_str(), R_OK);
+       if (accessible != 0) assets += " (no access)";
+
+       char* temp = getenv("YOINK_DATADIR");
+       if (temp)
+       {
+               datadir = temp;
+               accessible = access(temp, R_OK);
+               if (accessible != 0) datadir += " (no access)";
+       }
+
+       temp = getenv("YOINKRC");
+       if (temp)
+       {
+               config = temp;
+               accessible = access(temp, R_OK);
+               if (accessible != 0) config += " (no access)";
+       }
+
+       std::cout << "   Executable: " << argv[0] << std::endl
+                         << "      Version: "VERSION << std::endl
 #ifdef __DATE__
-                         << "When compiled: "__DATE__" "__TIME__ << std::endl
+                         << "        Built: "__DATE__" "__TIME__ << std::endl
 #endif
-                         << "Compiler: "COMPILER_STRING << std::endl
-                         << "Asset directory: "YOINK_DATADIR << std::endl
+                         << "     Compiler: "COMPILER_STRING << std::endl
+                         << "       Assets: " << assets << std::endl
                          << "Build options: "
 #ifdef NDEBUG
                          << "-"
@@ -213,11 +239,9 @@ void printInfo()
 #ifndef USE_THREADS
                          << "-"
 #endif
-                         << "threads "
-                         << std::endl;
-#if !defined (_WIN32) && !defined(__WIN32__)
-       system("uname -a");
-#endif
+                         << "threads" << std::endl
+                         << "      YOINKRC: " << config << std::endl
+                         << "YOINK_DATADIR: " << datadir << std::endl;
 }
 
 void goodbye()
@@ -239,7 +263,7 @@ int main(int argc, char* argv[])
                }
                else if (arg == "-i" || arg == "--info")
                {
-                       printInfo();
+                       printInfo(argc, argv);
                        return 0;
                }
        }
This page took 0.018609 seconds and 4 git commands to generate.