fixed so it compiles under windows.

This commit is contained in:
Johan Althoff 2007-11-18 22:06:41 +00:00
parent 65c7ab0a40
commit b44a3edfe9
5 changed files with 20 additions and 6 deletions

View file

@ -170,6 +170,7 @@ function build(settings)
settings.linker.libs:add("user32.lib")
settings.linker.libs:add("ws2_32.lib")
settings.linker.libs:add("ole32.lib")
settings.linker.libs:add("shell32.lib")
end
-- build glfw

View file

@ -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;
}

View file

@ -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,7 +653,13 @@ 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;
@ -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;

View file

@ -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)

View file

@ -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);