diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-08 09:11:32 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-08 09:11:32 +0000 |
| commit | 711aa0db763e31bd7916ea31f5f3f934e4000ab8 (patch) | |
| tree | e1686806f10c77b8fa3e8e0225d12e726de4e136 /src/engine/system.c | |
| parent | 4fcab5c8f1b2d4f8405d4ef86b69d2c916184929 (diff) | |
| download | zcatch-711aa0db763e31bd7916ea31f5f3f934e4000ab8.tar.gz zcatch-711aa0db763e31bd7916ea31f5f3f934e4000ab8.zip | |
update, gui stuff, some engine stuff
Diffstat (limited to 'src/engine/system.c')
| -rw-r--r-- | src/engine/system.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/engine/system.c b/src/engine/system.c index 71f5b545..a6fb362c 100644 --- a/src/engine/system.c +++ b/src/engine/system.c @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdarg.h> #include <string.h> +#include <ctype.h> #include <time.h> #include "detect.h" @@ -12,6 +13,7 @@ #include <unistd.h> /* unix net includes */ + #include <sys/stat.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> @@ -643,6 +645,37 @@ int fs_listdir(const char *dir, fs_listdir_callback cb, void *user) #endif } +int fs_storage_path(const char *appname, char *path, int max) +{ +#if defined(CONF_FAMILY_WINDOWS) + #error not implement +#else + char *home = getenv("HOME"); + int i; + if(!home) + return 0; + + snprintf(path, max, "%s/.%s", home, appname); + for(i = strlen(home)+2; path[i]; i++) + path[i] = tolower(path[i]); + + return 1; +#endif +} + +int fs_makedir(const char *path) +{ +#if defined(CONF_FAMILY_WINDOWS) + #error not implement +#else + if(mkdir(path, 0755) == 0) + return 0; + if(errno == EEXIST) + return 0; + return 1; +#endif +} + void swap_endian(void *data, unsigned elem_size, unsigned num) { char *src = (char*) data; |