RawTherapee crashes in c:\users\{username}, Issue 2727

This commit is contained in:
Ingo
2015-03-30 22:38:44 +02:00
parent a88ef728bf
commit 4f2e23d16f
2 changed files with 16 additions and 3 deletions

View File

@@ -465,6 +465,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
// get_user_special_dir/pictures crashes on some Windows configurations.
@@ -490,6 +502,6 @@ 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;
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

View File

@@ -45,6 +45,7 @@ Glib::ustring safe_get_user_home_dir();
Glib::ustring safe_get_user_desktop_dir();
#ifdef WIN32
Glib::ustring safe_get_user_profile_dir();
bool safe_is_shortcut_dir (const Glib::ustring& filename);
#endif