==================== idStr::ExtractFileExtension ==================== */
| 1010 | ==================== |
| 1011 | */ |
| 1012 | void idStr::ExtractFileExtension( idStr &dest ) const { |
| 1013 | int pos; |
| 1014 | |
| 1015 | // |
| 1016 | // back up until a . or the start |
| 1017 | // |
| 1018 | pos = Length() - 1; |
| 1019 | while( ( pos > 0 ) && ( ( *this )[ pos - 1 ] != '.' ) ) { |
| 1020 | pos--; |
| 1021 | if( isDirSeparator( ( *this )[ pos ] ) ) { // DG: check for directory separator |
| 1022 | // no extension in the whole filename |
| 1023 | dest.Empty(); |
| 1024 | } // DG end |
| 1025 | } |
| 1026 | |
| 1027 | if ( !pos ) { |
| 1028 | // no extension |
| 1029 | dest.Empty(); |
| 1030 | } else { |
| 1031 | Right( Length() - pos, dest ); |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | |
| 1036 | /* |
no test coverage detected