minor refactoring

This commit is contained in:
Garux
2020-05-05 12:32:44 +03:00
parent 13f877b7db
commit 002f45d6d9
2 changed files with 20 additions and 21 deletions

View File

@@ -232,19 +232,21 @@ DirectoryCleaned( const char* path ) : m_path( path ){
template<typename TextOutputStreamType>
TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const DirectoryCleaned& path ){
const char* i = path.m_path;
for (; *i != '\0'; ++i )
{
if ( *i == '\\' ) {
if( !string_empty( i ) ){
for (; *i != '\0'; ++i )
{
if ( *i == '\\' ) {
ostream << '/';
}
else
{
ostream << *i;
}
}
--i;
if ( *i != '/' && *i != '\\' ) {
ostream << '/';
}
else
{
ostream << *i;
}
}
char c = *( i - 1 );
if ( c != '/' && c != '\\' && !string_empty( path.m_path ) ) {
ostream << '/';
}
return ostream;
}