Commit 7e44fa82 authored by Rémi Duraffort's avatar Rémi Duraffort

filename_sanitize: spaces are forbidden only when beginning and ending.

parent 4638fd98
......@@ -1034,6 +1034,12 @@ char* filename_sanitize( const char *str_origin )
return str_base;
}
#if defined( WIN32 )
// Change leading spaces into underscores
while( *str && *str == ' ' )
*str++ = '_';
#endif
while( *str )
{
switch( *str )
......@@ -1050,12 +1056,23 @@ char* filename_sanitize( const char *str_origin )
case '|':
case '<':
case '>':
case ' ':
#endif
*str = '_';
}
str++;
}
#if defined( WIN32 )
// Change trailing spaces into underscores
str--;
while( str != str_base )
{
if( *str != ' ' )
break;
*str-- = '_';
}
#endif
return str_base;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment