Browse Source

Fix for include optional

Bill Hoffman 23 years ago
parent
commit
badbd8dc8d
2 changed files with 12 additions and 6 deletions
  1. 10 5
      Source/cmSystemTools.cxx
  2. 2 1
      Source/cmSystemTools.h

+ 10 - 5
Source/cmSystemTools.cxx

@@ -1734,7 +1734,8 @@ std::string cmSystemTools::GetProgramPath(const char* in_name)
  */
 void cmSystemTools::SplitProgramPath(const char* in_name,
                                      std::string& dir,
-                                     std::string& file)
+                                     std::string& file,
+                                     bool errorReport)
 {
   dir = in_name;
   file = "";
@@ -1758,9 +1759,13 @@ void cmSystemTools::SplitProgramPath(const char* in_name,
     {
     std::string oldDir = in_name;
     cmSystemTools::ConvertToUnixSlashes(oldDir);
-    cmSystemTools::Error("Error splitting file name off end of path:\n",
-                         oldDir.c_str(), "\nDirectory not found: ", 
-                         dir.c_str());
+    if(errorReport)
+      {
+      cmSystemTools::Error("Error splitting file name off end of path:\n",
+                           oldDir.c_str(), "\nDirectory not found: ", 
+                           dir.c_str());
+      }
+    
     dir = in_name;
     return;
     }
@@ -1781,7 +1786,7 @@ std::string cmSystemTools::CollapseFullPath(const char* in_relative,
                                             const char* in_base)
 {
   std::string dir, file;
-  cmSystemTools::SplitProgramPath(in_relative, dir, file);
+  cmSystemTools::SplitProgramPath(in_relative, dir, file, false);
   
   // Save original working directory.
   std::string orig = cmSystemTools::GetCurrentWorkingDirectory();

+ 2 - 1
Source/cmSystemTools.h

@@ -264,7 +264,8 @@ public:
   static std::string GetProgramPath(const char*);
   static void SplitProgramPath(const char* in_name, 
                                std::string& dir, 
-                               std::string& file);
+                               std::string& file,
+                               bool errorReport = true);
   static std::string CollapseFullPath(const char* in_relative);
   static std::string CollapseFullPath(const char* in_relative,
                                       const char* in_base);