Browse Source

BUG: fix generated files with no extension bug

Bill Hoffman 24 years ago
parent
commit
252f9fc1b1

+ 6 - 1
Source/cmSourceFile.cxx

@@ -160,7 +160,12 @@ void cmSourceFile::SetName(const char* name, const char* dir, const char *ext,
     pathname += "/";
     }
   
-  pathname += m_SourceName + "." + ext;
+  pathname += m_SourceName;
+  if(ext && strlen(ext))
+    {
+    pathname += ".";
+    pathname += ext;
+    }
   m_FullPath = pathname;
   m_SourceExtension = ext;
   return;

+ 1 - 1
Source/cmSourceFilesCommand.cxx

@@ -76,7 +76,7 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
       std::string ext = cmSystemTools::GetFilenameExtension(copy);
       std::string name_no_ext = cmSystemTools::GetFilenameName(copy.c_str());
       name_no_ext = name_no_ext.substr(0, name_no_ext.length()-ext.length());
-      if ( ext[0] == '.' )
+      if ( ext.length() && ext[0] == '.' )
 	{
 	ext = ext.substr(1);
 	}

+ 1 - 1
Source/cmSourceFilesRemoveCommand.cxx

@@ -67,7 +67,7 @@ bool cmSourceFilesRemoveCommand::InitialPass(std::vector<std::string> const& arg
       std::string path = cmSystemTools::GetFilenamePath(copy);
       std::string name_no_ext = cmSystemTools::GetFilenameName(copy.c_str());
       name_no_ext = name_no_ext.substr(0, name_no_ext.length()-ext.length());
-      if ( ext[0] == '.' )
+      if ( ext.length() && ext[0] == '.' )
 	{
 	ext = ext.substr(1);
 	}