Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemPathsWin32.cpp
| Show All 33 Lines | |||||
| } | } | ||||
| GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32() | GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32() | ||||
| { | { | ||||
| } | } | ||||
| const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const | const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const | ||||
| { | { | ||||
| static char knownpath[MAX_PATH * 3 + 128] = { | /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/ | ||||
| 0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/ | static char knownpath[MAX_PATH * 3 + 128] = {0}; | ||||
| wchar_t knownpath_16[MAX_PATH]; | PWSTR knownpath_16 = NULL; | ||||
| HRESULT hResult = SHGetFolderPathW( | HRESULT hResult = SHGetKnownFolderPath( | ||||
| NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16); | FOLDERID_ProgramData, KF_FLAG_DEFAULT, NULL, &knownpath_16); | ||||
| if (hResult == S_OK) { | if (hResult == S_OK) { | ||||
| conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3); | conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3); | ||||
| CoTaskMemFree(knownpath_16); | |||||
| strcat(knownpath, "\\Blender Foundation\\Blender\\"); | strcat(knownpath, "\\Blender Foundation\\Blender\\"); | ||||
| strcat(knownpath, versionstr); | strcat(knownpath, versionstr); | ||||
| return (GHOST_TUns8 *)knownpath; | return (GHOST_TUns8 *)knownpath; | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const | const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const | ||||
| { | { | ||||
| static char knownpath[MAX_PATH * 3 + 128] = {0}; | static char knownpath[MAX_PATH * 3 + 128] = {0}; | ||||
| wchar_t knownpath_16[MAX_PATH]; | PWSTR knownpath_16 = NULL; | ||||
| HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16); | HRESULT hResult = SHGetKnownFolderPath( | ||||
| FOLDERID_RoamingAppData, KF_FLAG_DEFAULT, NULL, &knownpath_16); | |||||
| if (hResult == S_OK) { | if (hResult == S_OK) { | ||||
| conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3); | conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3); | ||||
| CoTaskMemFree(knownpath_16); | |||||
| strcat(knownpath, "\\Blender Foundation\\Blender\\"); | strcat(knownpath, "\\Blender Foundation\\Blender\\"); | ||||
| strcat(knownpath, versionstr); | strcat(knownpath, versionstr); | ||||
| return (GHOST_TUns8 *)knownpath; | return (GHOST_TUns8 *)knownpath; | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Show All 20 Lines | |||||