fix build on windows, mkIII

This commit is contained in:
Tim Felgentreff 2020-11-30 07:58:54 +01:00
parent 77fe9d0121
commit d4b1a6c58c
3 changed files with 12 additions and 2 deletions

View file

@ -187,7 +187,7 @@ stratagus-game-launcher.h - Stratagus Game Launcher
static void SetUserDataPath(char* data_path) { static void SetUserDataPath(char* data_path) {
#if defined(WIN32) #if defined(WIN32)
SHGetFolderPath(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, data_path); SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, data_path);
// strcpy(data_path, getenv("APPDATA")); // strcpy(data_path, getenv("APPDATA"));
#else #else
strcpy(data_path, getenv("HOME")); strcpy(data_path, getenv("HOME"));

View file

@ -49,6 +49,12 @@ void copy_dir(const char* source_folder, const char* target_folder);
#endif #endif
#ifdef WIN32 #ifdef WIN32
// set everything to winxp sp2 compatiblity
#define NTDDI_VERSION 0x05010300
#define _WIN32_WINNT 0x0502
#define WINVER 0x0502
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX MAX_PATH #define PATH_MAX MAX_PATH
#endif #endif

View file

@ -36,6 +36,10 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef USE_WIN32 #ifdef USE_WIN32
// set everything to winxp sp2 compatiblity
#define NTDDI_VERSION 0x05010300
#define _WIN32_WINNT 0x0502
#define WINVER 0x0502
#include <Shlobj.h> #include <Shlobj.h>
#endif #endif
@ -56,7 +60,7 @@ void Parameters::SetDefaultUserDirectory()
userDirectory = StratagusLibPath; userDirectory = StratagusLibPath;
#elif USE_WIN32 #elif USE_WIN32
char data_path[4096] = {'\0'}; char data_path[4096] = {'\0'};
SHGetFolderPath(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, data_path); SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, data_path);
userDirectory = data_path; userDirectory = data_path;
// userDirectory = getenv("APPDATA"); // userDirectory = getenv("APPDATA");
#else #else