Cleanup of AppFolder path detection (Windows)
This commit is contained in:
@@ -26,6 +26,11 @@
|
|||||||
#include <safegtk.h>
|
#include <safegtk.h>
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#include <Shlobj.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
Options options;
|
Options options;
|
||||||
Glib::ustring versionString = VERSION;
|
Glib::ustring versionString = VERSION;
|
||||||
Glib::ustring paramFileExtension = ".pp3";
|
Glib::ustring paramFileExtension = ".pp3";
|
||||||
@@ -508,28 +513,24 @@ void Options::load () {
|
|||||||
*
|
*
|
||||||
* Folder redirection is then fully supported on WinVista/7, but not on Win2000/XP
|
* Folder redirection is then fully supported on WinVista/7, but not on Win2000/XP
|
||||||
*/
|
*/
|
||||||
const gchar* dataPath;
|
|
||||||
Glib::ustring dPath;
|
|
||||||
|
|
||||||
// ->ODUIS: How to make that commented out code work ?
|
WCHAR path[MAX_PATH];
|
||||||
|
|
||||||
/*WCHAR path[MAX_PATH] = {0};
|
|
||||||
if (SHGetSpecialFolderPathW(NULL, path, CSIDL_LOCAL_APPDATA, false)) {
|
if (SHGetSpecialFolderPathW(NULL, path, CSIDL_LOCAL_APPDATA, false)) {
|
||||||
dPath = path;
|
gchar* pathUTF8=g_utf16_to_utf8((const gunichar2*)path,-1,NULL,NULL,NULL);
|
||||||
printf("SHGetSpecialFolderPathW: \"%s\"\n", dPath.c_str());
|
rtdir = Glib::ustring(pathUTF8) + Glib::ustring("\\") + Glib::ustring(CACHEFOLDERNAME);
|
||||||
|
g_free(pathUTF8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("SHGetSpecialFolderPathW: Fail!\n");
|
// Should never fail, but old alternative way as backup
|
||||||
}*/
|
const gchar* dataPath = g_getenv("LOCALAPPDATA");
|
||||||
|
if (dataPath != NULL)
|
||||||
dataPath = g_getenv("LOCALAPPDATA");
|
rtdir = Glib::ustring(dataPath) + Glib::ustring("\\") + Glib::ustring(CACHEFOLDERNAME);
|
||||||
if (dataPath != NULL)
|
else {
|
||||||
rtdir = Glib::ustring(dataPath) + Glib::ustring("\\") + Glib::ustring(CACHEFOLDERNAME);
|
dataPath = g_getenv("USERPROFILE");
|
||||||
else {
|
if (dataPath != NULL)
|
||||||
dataPath = g_getenv("USERPROFILE");
|
rtdir = Glib::ustring(dataPath) + Glib::ustring("\\Local Settings\\Application Data\\") + Glib::ustring(CACHEFOLDERNAME);
|
||||||
if (dataPath != NULL)
|
}
|
||||||
rtdir = Glib::ustring(dataPath) + Glib::ustring("\\Local Settings\\Application Data\\") + Glib::ustring(CACHEFOLDERNAME);
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
rtdir = Glib::ustring(g_get_user_config_dir ()) + Glib::ustring("/") + Glib::ustring(CACHEFOLDERNAME);
|
rtdir = Glib::ustring(g_get_user_config_dir ()) + Glib::ustring("/") + Glib::ustring(CACHEFOLDERNAME);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user