We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2926541 commit 6b4efc2Copy full SHA for 6b4efc2
core/src/string_const.cpp
@@ -180,16 +180,17 @@ char *strdupS( const char *str )
180
181
const string getDirectory( const string filename )
182
{
183
- size_t index;
184
-
185
- index = filename.rfind( NIX_PATH_SEP );
+ size_t index = filename.rfind( NIX_PATH_SEP );
+
186
#ifdef WIN32
187
- if( ( filename.rfind( WIN_PATH_SEP ) > index ) || ( index == string::npos ) )
+ size_t winIndex = filename.rfind( WIN_PATH_SEP );
+ if( ( winIndex != string::npos ) &&
188
+ (( index == string::npos ) || (winIndex > index)))
189
- index = filename.rfind( WIN_PATH_SEP );
190
+ index = winIndex;
191
}
192
#endif
193
194
if( index == string::npos )
195
196
return string();
0 commit comments