Fixed compilation on 32bit Windows, cleanups
see issue 1333
This commit is contained in:
@@ -25,6 +25,10 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
// for GCC32
|
||||||
|
#ifndef _WIN32_IE
|
||||||
|
#define _WIN32_IE 0x0600
|
||||||
|
#endif
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#else
|
#else
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@@ -344,9 +348,7 @@ int safe_g_mkdir_with_parents(const Glib::ustring& dirName, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring safe_get_user_picture_dir() {
|
Glib::ustring safe_get_user_picture_dir() {
|
||||||
// TODO: MINGW32 has a problem with header files
|
#ifdef WIN32
|
||||||
#ifdef __MINGW64_VERSION_MAJOR
|
|
||||||
|
|
||||||
// get_user_special_dir/pictures crashes on some Windows configurations.
|
// get_user_special_dir/pictures crashes on some Windows configurations.
|
||||||
// so we use the safe native functions here
|
// so we use the safe native functions here
|
||||||
WCHAR pathW[MAX_PATH]={0};
|
WCHAR pathW[MAX_PATH]={0};
|
||||||
|
@@ -23,6 +23,10 @@
|
|||||||
#include "../rtengine/safegtk.h"
|
#include "../rtengine/safegtk.h"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
// for GCC32
|
||||||
|
#ifndef _WIN32_IE
|
||||||
|
#define _WIN32_IE 0x0600
|
||||||
|
#endif
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
// for GCC32
|
||||||
|
#ifndef _WIN32_IE
|
||||||
|
#define _WIN32_IE 0x0600
|
||||||
|
#endif
|
||||||
#include <Shlobj.h>
|
#include <Shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -753,37 +757,18 @@ void Options::load () {
|
|||||||
// Find the application data path
|
// Find the application data path
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/*
|
|
||||||
* If LOCALAPPDATA exists, RT run on a WinVista/7 system, so we use LOCALAPPDATA as is
|
|
||||||
* otherwise RT run on a Win2000/XP system, so we rebuild the path like this: %USERPROFILE%\Local Settings\Application Data
|
|
||||||
*
|
|
||||||
* Folder redirection is then fully supported on WinVista/7, but not on Win2000/XP
|
|
||||||
*/
|
|
||||||
const gchar* dataPath;
|
const gchar* dataPath;
|
||||||
Glib::ustring dPath;
|
Glib::ustring dPath;
|
||||||
|
|
||||||
// ->ODUIS: How to make that commented out code work ?
|
|
||||||
|
|
||||||
/*WCHAR path[MAX_PATH] = {0};
|
|
||||||
if (SHGetSpecialFolderPathW(NULL, path, CSIDL_LOCAL_APPDATA, false)) {
|
|
||||||
dPath = path;
|
|
||||||
printf("SHGetSpecialFolderPathW: \"%s\"\n", dPath.c_str());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("SHGetSpecialFolderPathW: Fail!\n");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
dataPath = g_getenv("RT_CACHE");
|
dataPath = g_getenv("RT_CACHE");
|
||||||
if (dataPath != NULL)
|
if (dataPath != NULL)
|
||||||
rtdir = Glib::ustring(dataPath);
|
rtdir = Glib::ustring(dataPath);
|
||||||
else {
|
else {
|
||||||
dataPath = g_getenv("LOCALAPPDATA");
|
WCHAR pathW[MAX_PATH]={0}; char pathA[MAX_PATH];
|
||||||
if (dataPath != NULL)
|
|
||||||
rtdir = Glib::ustring(dataPath) + Glib::ustring("\\") + Glib::ustring(CACHEFOLDERNAME);
|
if (SHGetSpecialFolderPathW(NULL,pathW,CSIDL_LOCAL_APPDATA,false)) {
|
||||||
else {
|
WideCharToMultiByte(CP_UTF8,0,pathW,-1,pathA,MAX_PATH,0,0);
|
||||||
dataPath = g_getenv("USERPROFILE");
|
rtdir = Glib::ustring(pathA) + Glib::ustring("\\") + Glib::ustring(CACHEFOLDERNAME);
|
||||||
if (dataPath != NULL)
|
|
||||||
rtdir = Glib::ustring(dataPath) + Glib::ustring("\\Local Settings\\Application Data\\") + Glib::ustring(CACHEFOLDERNAME);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user