MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ExtractFileExtension

Method ExtractFileExtension

neo/idlib/Str.cpp:1012–1033  ·  view source on GitHub ↗

==================== idStr::ExtractFileExtension ==================== */

Source from the content-addressed store, hash-verified

1010====================
1011*/
1012void 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/*

Callers 14

ParseMethod · 0.80
GetAnimMethod · 0.80
OpenFileMethod · 0.80
HandleInitDialogMethod · 0.80
R_LoadImageFunction · 0.80
GetModelMethod · 0.80
InitFromFileMethod · 0.80
Sys_ListFilesFunction · 0.80
Sys_ListFilesFunction · 0.80
LoadRenderModelMethod · 0.80
ParseMethod · 0.80

Calls 2

isDirSeparatorFunction · 0.85
EmptyMethod · 0.45

Tested by

no test coverage detected