Merge branch 'w32_unicode_compilation'

This commit is contained in:
Alexander van Gessel 2014-04-06 21:09:45 +02:00
commit a29ba939b7
4 changed files with 11 additions and 7 deletions

View file

@ -25,7 +25,9 @@
#elif defined(_WIN32)
#ifndef UNICODE
#define UNICODE
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View file

@ -524,14 +524,14 @@ void set_user_data_dir(std::string path)
//allow absolute path override
user_data_dir = path;
} else {
typedef BOOL (WINAPI *SHGSFPAddress)(HWND, LPTSTR, int, BOOL);
SHGSFPAddress SHGetSpecialFolderPath;
HMODULE module = LoadLibrary("shell32");
SHGetSpecialFolderPath = reinterpret_cast<SHGSFPAddress>(GetProcAddress(module, "SHGetSpecialFolderPathA"));
if(SHGetSpecialFolderPath) {
typedef BOOL (WINAPI *SHGSFPAddress)(HWND, LPSTR, int, BOOL);
SHGSFPAddress SHGetSpecialFolderPathA;
HMODULE module = LoadLibraryA("shell32");
SHGetSpecialFolderPathA = reinterpret_cast<SHGSFPAddress>(GetProcAddress(module, "SHGetSpecialFolderPathA"));
if(SHGetSpecialFolderPathA) {
LOG_FS << "Using SHGetSpecialFolderPath to find My Documents\n";
char my_documents_path[MAX_PATH];
if(SHGetSpecialFolderPath(NULL, my_documents_path, 5, 1)) {
if(SHGetSpecialFolderPathA(NULL, my_documents_path, 5, 1)) {
std::string mygames_path = std::string(my_documents_path) + "/" + "My Games";
boost::algorithm::replace_all(mygames_path, std::string("\\"), std::string("/"));
create_directory_if_missing(mygames_path);

View file

@ -112,7 +112,7 @@ DIR *opendir(char const *name)
// Must be a valid name
if( !name ||
!*name ||
(dwAttr = GetFileAttributes(name)) == 0xFFFFFFFF)
(dwAttr = GetFileAttributesA(name)) == 0xFFFFFFFF)
{
errno = ENOENT;
}

View file

@ -18,7 +18,9 @@
#include <SDL.h>
#include <string>
//forces to call Unicode winapi functions instead of ASCII (default)
#ifndef UNICODE
#define UNICODE
#endif
//defines that mingw misses
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600 //specifying target platform to be Windows XP and higher