BUG: fix generated files with no extension bug

This commit is contained in:
Bill Hoffman 2002-01-21 10:11:47 -05:00
parent 7bda70b836
commit 252f9fc1b1
3 changed files with 8 additions and 3 deletions

View File

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

View File

@ -76,7 +76,7 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
std::string ext = cmSystemTools::GetFilenameExtension(copy); std::string ext = cmSystemTools::GetFilenameExtension(copy);
std::string name_no_ext = cmSystemTools::GetFilenameName(copy.c_str()); std::string name_no_ext = cmSystemTools::GetFilenameName(copy.c_str());
name_no_ext = name_no_ext.substr(0, name_no_ext.length()-ext.length()); 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); ext = ext.substr(1);
} }

View File

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