Showing the changes to src/core/util_string.cpp (1 of 4 files). Show all
Unified · Split
| @@ -723,3 +723,19 @@ t_CKBOOL is_absolute_path( const std::string & path ) · 722 unmodified lines | |||
| 723 | return( path.length() != 0 && path[0] == '/' ); | 723 | return( path.length() != 0 && path[0] == '/' ); |
| 724 | #endif | 724 | #endif |
| 725 | } | 725 | } |
| 726 | |||
| 727 | |||
| 728 | |||
| 729 | |||
| 730 | //----------------------------------------------------------------------------- | ||
| 731 | // name: extension_matches() | ||
| 732 | // desc: check whether a filename matches a particular extension | ||
| 733 | //----------------------------------------------------------------------------- | ||
| 734 | t_CKBOOL extension_matches( const char * filename, const char * extension ) | ||
| 735 | { | ||
| 736 | t_CKUINT extension_length = strlen( extension ); | ||
| 737 | t_CKUINT filename_length = strlen( filename ); | ||
| 738 | |||
| 739 | return strncmp( extension, filename+(filename_length-extension_length), | ||
| 740 | extension_length ) == 0; | ||
| 741 | } | ||