diff options
| author | Choupom <andycootlapin@hotmail.fr> | 2010-09-12 13:15:59 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-09-16 12:28:10 +0200 |
| commit | 582763bc2148138e7da310268b58fdde4e6a6c43 (patch) | |
| tree | 2841e299e5f6c5a7b5ca14295b5fc79987afae72 /src/base | |
| parent | c52ee7baa9b4bf5845b2eeff63b4f6b713341c86 (diff) | |
| download | zcatch-582763bc2148138e7da310268b58fdde4e6a6c43.tar.gz zcatch-582763bc2148138e7da310268b58fdde4e6a6c43.zip | |
made folders in editor (#80)
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/system.c | 14 | ||||
| -rw-r--r-- | src/base/system.h | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/base/system.c b/src/base/system.c index 5f4f9d0d..9a291045 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -984,6 +984,20 @@ int fs_chdir(const char *path) return 1; } +void fs_parent_dir(const char *path, char *buffer) +{ + int stop = 0; + int i = 0; + for(i = 0; i < 256; i++) + { + if(path[i] == '/') + stop = i+1; + } + + //keep the chars which are before the last '/' and remove the chars which are after + str_copy(buffer, path, stop); +} + void swap_endian(void *data, unsigned elem_size, unsigned num) { char *src = (char*) data; diff --git a/src/base/system.h b/src/base/system.h index 1b4d52aa..c9d25260 100644 --- a/src/base/system.h +++ b/src/base/system.h @@ -945,6 +945,16 @@ int fs_is_dir(const char *path); int fs_chdir(const char *path); /* + Function: fs_parent_dir + Get the parent directory of a directory + + Parameters: + path - The directory + buffer - Buffer to set the parent folder +*/ +void fs_parent_dir(const char *path, char *buffer); + +/* Group: Undocumented */ |