diff options
| author | Johan Althoff <teetow@gmail.com> | 2007-11-18 22:06:41 +0000 |
|---|---|---|
| committer | Johan Althoff <teetow@gmail.com> | 2007-11-18 22:06:41 +0000 |
| commit | b44a3edfe9363163ab129594cba51a989c042644 (patch) | |
| tree | b7f56f9118ecd37880f5404b51c7dd8df12ed970 /src | |
| parent | 65c7ab0a40497887fe38b5c1c49034ecd2a40c81 (diff) | |
| download | zcatch-b44a3edfe9363163ab129594cba51a989c042644.tar.gz zcatch-b44a3edfe9363163ab129594cba51a989c042644.zip | |
fixed so it compiles under windows.
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/engine.c | 2 | ||||
| -rw-r--r-- | src/engine/system.c | 19 | ||||
| -rw-r--r-- | src/game/client/cl_skin.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/cl_skin.h | 2 |
4 files changed, 19 insertions, 6 deletions
diff --git a/src/engine/engine.c b/src/engine/engine.c index f3bee450..4ec67da1 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -9,7 +9,7 @@ static char application_save_path[512] = {0}; const char *engine_savepath(const char *filename, char *buffer, int max) { - snprintf(buffer, max, "%s/%s", application_save_path, filename); + sprintf(buffer, "%s/%s", application_save_path, filename); return buffer; } diff --git a/src/engine/system.c b/src/engine/system.c index e0fcc0b5..4a7670eb 100644 --- a/src/engine/system.c +++ b/src/engine/system.c @@ -31,7 +31,10 @@ #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> + #include <shlobj.h> // for SHGetFolderPathAndSubDir #include <fcntl.h> + #include <direct.h> + #include <errno.h> #define EWOULDBLOCK WSAEWOULDBLOCK #else @@ -650,13 +653,19 @@ int fs_listdir(const char *dir, fs_listdir_callback cb, void *user) int fs_storage_path(const char *appname, char *path, int max) { #if defined(CONF_FAMILY_WINDOWS) - #error not implement + HRESULT r; + char home[MAX_PATH]; + r = SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, home); + if(r != 0) + return 1; + _snprintf(path, max, "%s/%s", home, appname); + return 0; #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]); @@ -668,7 +677,11 @@ int fs_storage_path(const char *appname, char *path, int max) int fs_makedir(const char *path) { #if defined(CONF_FAMILY_WINDOWS) - #error not implement + if(_mkdir(path) == 0) + return 0; + if(errno == EEXIST) + return 0; + return 1; #else if(mkdir(path, 0755) == 0) return 0; diff --git a/src/game/client/cl_skin.cpp b/src/game/client/cl_skin.cpp index 292b0a99..fcdd0207 100644 --- a/src/game/client/cl_skin.cpp +++ b/src/game/client/cl_skin.cpp @@ -10,7 +10,7 @@ enum MAX_SKINS=256, }; -static skin skins[MAX_SKINS] = {{-1, -1, {0}, {0}}}; +static skin skins[MAX_SKINS] = {0}; static int num_skins = 0; static void skinscan(const char *name, int is_dir, void *user) diff --git a/src/game/client/cl_skin.h b/src/game/client/cl_skin.h index 0b5875b3..a114789d 100644 --- a/src/game/client/cl_skin.h +++ b/src/game/client/cl_skin.h @@ -6,7 +6,7 @@ typedef struct int org_texture; int color_texture; char name[31]; - const char term[1]; + char term[1]; } skin; vec4 skin_get_color(int v); |