Skip to content

Commit

Permalink
Load settings from user's profile folder (home directory) instead of …
Browse files Browse the repository at this point in the history
…"My Documents" folder, fix commit 63f3bad.
  • Loading branch information
zufuliu committed Jan 15, 2019
1 parent cac743c commit 1796663
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -2886,9 +2886,16 @@ int CheckIniFile(LPWSTR lpszFile, LPCWSTR lpszModule) {
lstrcpy(lpszFile, tchBuild);
return 1;
}
// Application Data or My Documents
if (S_OK == SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild)
|| S_OK == SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, tchBuild)) {
// Application Data
if (S_OK == SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild)) {
PathAppend(tchBuild, tchFileExpanded);
if (PathFileExists(tchBuild)) {
lstrcpy(lpszFile, tchBuild);
return 1;
}
}
// Home
if (S_OK == SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, tchBuild)) {
PathAppend(tchBuild, tchFileExpanded);
if (PathFileExists(tchBuild)) {
lstrcpy(lpszFile, tchBuild);
Expand Down
13 changes: 10 additions & 3 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6380,9 +6380,16 @@ int CheckIniFile(LPWSTR lpszFile, LPCWSTR lpszModule) {
lstrcpy(lpszFile, tchBuild);
return 1;
}
// Application Data or My Documents
if (S_OK == SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild)
|| S_OK == SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, tchBuild)) {
// Application Data
if (S_OK == SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, tchBuild)) {
PathAppend(tchBuild, tchFileExpanded);
if (PathFileExists(tchBuild)) {
lstrcpy(lpszFile, tchBuild);
return 1;
}
}
// Home
if (S_OK == SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, tchBuild)) {
PathAppend(tchBuild, tchFileExpanded);
if (PathFileExists(tchBuild)) {
lstrcpy(lpszFile, tchBuild);
Expand Down

0 comments on commit 1796663

Please sign in to comment.