diff options
Diffstat (limited to 'source/q_shared.c')
-rw-r--r-- | source/q_shared.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/q_shared.c b/source/q_shared.c index 6442483..fe04769 100644 --- a/source/q_shared.c +++ b/source/q_shared.c @@ -796,17 +796,16 @@ COM_FilePath Returns the path up to, but not including the last / ============ */ -void COM_FilePath( const char *in, char *out, int outSize ) { +void COM_FilePath( const char *in, char *out, int size ) { char *s; - Q_strncpyz( out, in, outSize ); - - s = out + strlen( out ); - - while( s != out && *s != '/' ) - s--; - - *s = 0; + Q_strncpyz( out, in, size ); + s = strrchr( out, '/' ); + if( s ) { + *s = 0; + } else { + *out = 0; + } } |