From: sdottaka Date: Sun, 24 May 2015 09:12:19 +0000 (+0900) Subject: Environment.cpp: Copy env_GetMyDocuments() and env_GetWindowsDirectory() from WinMerg... X-Git-Tag: 2.16.4+-jp-10~850^2~46 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e7e40f2ac7e6c53a8807ba4965dff48c02dede7b;p=winmerge-jp%2Fwinmerge-jp.git Environment.cpp: Copy env_GetMyDocuments() and env_GetWindowsDirectory() from WinMerge2011 --HG-- branch : stable --- diff --git a/Src/Environment.cpp b/Src/Environment.cpp index be294e0c8..e12f58289 100644 --- a/Src/Environment.cpp +++ b/Src/Environment.cpp @@ -106,9 +106,10 @@ String env_GetProgPath() */ String env_GetWindowsDirectory() { - TCHAR buf[MAX_PATH] = {0}; - GetWindowsDirectory(buf, MAX_PATH); - return buf; + TCHAR path[MAX_PATH]; + path[0] = _T('\0'); + GetWindowsDirectory(path, MAX_PATH); + return path; } /** @@ -118,23 +119,9 @@ String env_GetWindowsDirectory() */ String env_GetMyDocuments() { - LPITEMIDLIST pidl; - LPMALLOC pMalloc; - String path; - - HRESULT rv = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl); - if (rv == S_OK) - { - TCHAR szPath[MAX_PATH] = {0}; - if (SHGetPathFromIDList(pidl, szPath)) - { - path = szPath; - } - - SHGetMalloc(&pMalloc); - pMalloc->Free(pidl); - pMalloc->Release(); - } + TCHAR path[MAX_PATH]; + path[0] = _T('\0'); + SHGetSpecialFolderPath(NULL, path, CSIDL_MYDOCUMENTS, FALSE); return path; }