From 439dd89a479e2d02fa40a421849c73616f92198e Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Fri, 7 Dec 2007 17:29:24 +0000 Subject: Optimized FS_ListFiles (and broken Windows build). Initial changes to demo browser to support caching. --- source/q_shared.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source/q_shared.c') 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; + } } -- cgit v1.2.3