diff options
| author | oy <Tom_Adams@web.de> | 2010-09-16 12:48:32 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-09-16 12:48:32 +0200 |
| commit | a2083b31e3692c97c3f74291d94b4fbb32a36cc6 (patch) | |
| tree | d8348cb53203a8c5d02f0c4b099e77bd43bac1fe /src/base/system.c | |
| parent | 582763bc2148138e7da310268b58fdde4e6a6c43 (diff) | |
| download | zcatch-a2083b31e3692c97c3f74291d94b4fbb32a36cc6.tar.gz zcatch-a2083b31e3692c97c3f74291d94b4fbb32a36cc6.zip | |
fixed last commit
Diffstat (limited to 'src/base/system.c')
| -rw-r--r-- | src/base/system.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/base/system.c b/src/base/system.c index 9a291045..5312a705 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -984,18 +984,17 @@ int fs_chdir(const char *path) return 1; } -void fs_parent_dir(const char *path, char *buffer) +void fs_parent_dir(char *path) { - int stop = 0; - int i = 0; - for(i = 0; i < 256; i++) + char *parent = 0; + for(; *path; ++path) { - if(path[i] == '/') - stop = i+1; + if(*path == '/' || *path == '\\') + parent = path; } - //keep the chars which are before the last '/' and remove the chars which are after - str_copy(buffer, path, stop); + if(parent) + *parent = 0; } void swap_endian(void *data, unsigned elem_size, unsigned num) |