Skip to content

Commit 6b4efc2

Browse files
committed
Fix use of unix directory separators on Windows
https://tracker.physiomeproject.org/show_bug.cgi?id=3815
1 parent 2926541 commit 6b4efc2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

core/src/string_const.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,17 @@ char *strdupS( const char *str )
180180

181181
const string getDirectory( const string filename )
182182
{
183-
size_t index;
184-
185-
index = filename.rfind( NIX_PATH_SEP );
183+
size_t index = filename.rfind( NIX_PATH_SEP );
184+
186185
#ifdef WIN32
187-
if( ( filename.rfind( WIN_PATH_SEP ) > index ) || ( index == string::npos ) )
186+
size_t winIndex = filename.rfind( WIN_PATH_SEP );
187+
if( ( winIndex != string::npos ) &&
188+
(( index == string::npos ) || (winIndex > index)))
188189
{
189-
index = filename.rfind( WIN_PATH_SEP );
190+
index = winIndex;
190191
}
191192
#endif
192-
193+
193194
if( index == string::npos )
194195
{
195196
return string();

0 commit comments

Comments
 (0)