make extension_equal() check case insensitive in Unix

allows most of file types with non lowercase extension
known issue: textures with non lowercase extension in loose folders are visible now, but they aren't loaded, because it leads to fopen( filename.lowercase_extension )
This commit is contained in:
Garux 2020-06-05 21:11:26 +03:00
parent 4fdb720123
commit 3e7ee32ded
3 changed files with 3 additions and 3 deletions

View File

@ -223,7 +223,7 @@ const char* file_dialog_show( GtkWidget* parent, bool open, const char* title, c
else{ /* validate extension */
bool valid = false;
for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
if( string_length( masks.m_filters[i].c_str() ) >= 2 && string_equal_nocase( extension, masks.m_filters[i].c_str() + 2 ) )
if( string_length( masks.m_filters[i].c_str() ) >= 2 && extension_equal( extension, masks.m_filters[i].c_str() + 2 ) )
valid = true;
if( !valid ){
g_file_dialog_file[0] = '\0';

View File

@ -170,7 +170,7 @@ inline const char* path_get_extension( const char* path ){
/// \brief Returns true if \p extension is of the same type as \p other.
/// O(n)
inline bool extension_equal( const char* extension, const char* other ){
return path_equal( extension, other );
return string_equal_nocase( extension, other );
}
template<typename Functor>

View File

@ -197,7 +197,7 @@ CopiedString g_openMapByCmd;
void cmdMap(){
for ( int i = 1; i < g_argc; ++i )
if( string_equal_suffix_nocase( g_argv[i], ".map" ) ){
if( extension_equal( path_get_extension( g_argv[i] ), "map" ) ){
StringOutputStream stream( 256 );
stream << PathCleaned( g_argv[i] );
g_openMapByCmd = stream.c_str();