optimize GetExtension
This commit is contained in:
@@ -317,10 +317,15 @@ CString SetExtension( const CString &path, const CString &ext )
|
|||||||
|
|
||||||
CString GetExtension( CString sPath )
|
CString GetExtension( CString sPath )
|
||||||
{
|
{
|
||||||
CString Dir, FName, Ext;
|
unsigned pos = sPath.rfind( '.' );
|
||||||
splitrelpath( sPath, Dir, FName, Ext );
|
if( pos == sPath.npos )
|
||||||
Ext.MakeLower();
|
return "";
|
||||||
return Ext;
|
|
||||||
|
unsigned slash = sPath.find( '/', slash );
|
||||||
|
if( slash != sPath.npos )
|
||||||
|
return ""; /* rare: path/dir.ext/fn */
|
||||||
|
|
||||||
|
return sPath.substr( pos+1, sPath.size()-pos+1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
CString GetCwd()
|
CString GetCwd()
|
||||||
|
|||||||
Reference in New Issue
Block a user