From 252f9fc1b16611dac74345b4612ef0ce3ff437ff Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 21 Jan 2002 10:11:47 -0500 Subject: [PATCH] BUG: fix generated files with no extension bug --- Source/cmSourceFile.cxx | 7 ++++++- Source/cmSourceFilesCommand.cxx | 2 +- Source/cmSourceFilesRemoveCommand.cxx | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 0fa21b8c23..965286d0a9 100644 --- a/Source/cmSourceFile.cxx +++ b/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; diff --git a/Source/cmSourceFilesCommand.cxx b/Source/cmSourceFilesCommand.cxx index e6d7176200..4b93f4cab9 100644 --- a/Source/cmSourceFilesCommand.cxx +++ b/Source/cmSourceFilesCommand.cxx @@ -76,7 +76,7 @@ bool cmSourceFilesCommand::InitialPass(std::vector 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); } diff --git a/Source/cmSourceFilesRemoveCommand.cxx b/Source/cmSourceFilesRemoveCommand.cxx index 0d1d4de422..e2cc875861 100644 --- a/Source/cmSourceFilesRemoveCommand.cxx +++ b/Source/cmSourceFilesRemoveCommand.cxx @@ -67,7 +67,7 @@ bool cmSourceFilesRemoveCommand::InitialPass(std::vector 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); }