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:
parent
4fdb720123
commit
3e7ee32ded
|
|
@ -223,7 +223,7 @@ const char* file_dialog_show( GtkWidget* parent, bool open, const char* title, c
|
||||||
else{ /* validate extension */
|
else{ /* validate extension */
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
|
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;
|
valid = true;
|
||||||
if( !valid ){
|
if( !valid ){
|
||||||
g_file_dialog_file[0] = '\0';
|
g_file_dialog_file[0] = '\0';
|
||||||
|
|
|
||||||
|
|
@ -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.
|
/// \brief Returns true if \p extension is of the same type as \p other.
|
||||||
/// O(n)
|
/// O(n)
|
||||||
inline bool extension_equal( const char* extension, const char* other ){
|
inline bool extension_equal( const char* extension, const char* other ){
|
||||||
return path_equal( extension, other );
|
return string_equal_nocase( extension, other );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ CopiedString g_openMapByCmd;
|
||||||
|
|
||||||
void cmdMap(){
|
void cmdMap(){
|
||||||
for ( int i = 1; i < g_argc; ++i )
|
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 );
|
StringOutputStream stream( 256 );
|
||||||
stream << PathCleaned( g_argv[i] );
|
stream << PathCleaned( g_argv[i] );
|
||||||
g_openMapByCmd = stream.c_str();
|
g_openMapByCmd = stream.c_str();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user