SetExtension does not modify sName. Also, after calling SetExtension( sName, "" ), the period is removed so if the file name is foo.bar.baz, then calling SetExtension with "" followed by "bur" you end up with foo.bur. Instead, just append "." + sExt.

This commit is contained in:
Steve Checkoway
2005-12-29 02:01:10 +00:00
parent 0e946835b6
commit 451bb4c396
+3 -3
View File
@@ -736,10 +736,10 @@ void MakeValidFilename( CString &sName )
if( Basename(sName).size() > 128 )
{
/* The filename is too long. Truncate it, but leave the extension alone. */
RString sExt = GetExtension( sName );
SetExtension( sName, "" );
const RString& sExt = GetExtension( sName );
sName = SetExtension( sName, "" );
sName.erase( 128 );
SetExtension( sName, sExt );
sName = sName + "." + sExt;
}
}