• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョンef3c3e6802893684d6c38a45fd4afe8816763aec (tree)
日時2014-04-26 11:58:35
作者toshinagata1964 <toshinagata1964@a2be...>
コミッターtoshinagata1964

ログメッセージ

MSW: document_home is modified to use the Windows API, instead of hard-coded path (which was wrong on Windows Vista and later)

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@536 a2be9bc6-48de-4e38-9406-05402d4bc13c

変更サマリ

差分

--- a/wxSources/MyApp.cpp
+++ b/wxSources/MyApp.cpp
@@ -1874,16 +1874,24 @@ MyAppCallback_getHomeDir(void)
18741874 return (s == NULL ? NULL : strdup(s));
18751875 }
18761876
1877+#if __WXMSW__
1878+#include <Shlobj.h>
1879+#endif
1880+
18771881 char *
18781882 MyAppCallback_getDocumentHomeDir(void)
18791883 {
1880- char *s;
18811884 #if __WXMSW__
1882- char *ss;
1883- s = getenv("USERPROFILE");
1884- asprintf(&ss, "%s\\My Documents", s);
1885- return ss;
1885+ char appData[MAX_PATH * 2];
1886+ HRESULT hResult;
1887+ hResult = SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, 0, appData);
1888+ if (hResult == S_OK) {
1889+ return strdup(appData);
1890+ } else {
1891+ return MyAppCallback_getHomeDir();
1892+ }
18861893 #else
1894+ char *s;
18871895 s = getenv("HOME");
18881896 return (s == NULL ? NULL : strdup(s));
18891897 #endif
旧リポジトリブラウザで表示