diff --git a/rtengine/safegtk.cc b/rtengine/safegtk.cc index 96be01bcb..71105b6af 100755 --- a/rtengine/safegtk.cc +++ b/rtengine/safegtk.cc @@ -464,6 +464,18 @@ Glib::ustring safe_get_user_home_dir() { #endif } + +#ifdef WIN32 +Glib::ustring safe_get_user_profile_dir() { + WCHAR pathW[MAX_PATH]={0}; + if (SHGetSpecialFolderPathW(NULL,pathW,CSIDL_PROFILE,false)) { + char pathA[MAX_PATH]; + WideCharToMultiByte(CP_UTF8,0,pathW,-1,pathA,MAX_PATH,0,0); + return Glib::ustring(pathA); + } else return Glib::ustring("C:\\"); +} +#endif + Glib::ustring safe_get_user_desktop_dir() { #ifdef WIN32 @@ -489,7 +501,7 @@ Glib::ustring safe_get_user_desktop_dir() { * * Warning: this function is a workaround for Windows platform, and not necessarily bullet proof */ -bool safe_is_shortcut_dir (const Glib::ustring& path) { - return PathIsRootA(path.c_str()) || safe_get_user_home_dir() == path || safe_get_user_desktop_dir() == path; // || safe_get_user_picture_dir() == path; +bool safe_is_shortcut_dir (const Glib::ustring& path) { + return PathIsRootA(path.c_str()) || safe_get_user_home_dir() == path || safe_get_user_desktop_dir() == path || safe_get_user_profile_dir() == path; // || safe_get_user_picture_dir() == path; } #endif diff --git a/rtengine/safegtk.h b/rtengine/safegtk.h index 95ebddbd5..eb10b7c5b 100644 --- a/rtengine/safegtk.h +++ b/rtengine/safegtk.h @@ -44,7 +44,8 @@ Glib::ustring safe_get_user_picture_dir(); Glib::ustring safe_get_user_home_dir(); Glib::ustring safe_get_user_desktop_dir(); -#ifdef WIN32 +#ifdef WIN32 +Glib::ustring safe_get_user_profile_dir(); bool safe_is_shortcut_dir (const Glib::ustring& filename); #endif