@@ -64,24 +64,24 @@ std::filesystem::path CControlProcess::GetIniFileName() const
6464 */
6565std::filesystem::path CControlProcess::GetPrivateIniFileName (const std::wstring& exeIniPath, const std::wstring& filename) const
6666{
67+ const auto nFolder = ::GetPrivateProfileInt (L" Settings" , L" UserRootFolder" , 0 , exeIniPath.c_str ());
6768 KNOWNFOLDERID refFolderId;
68- switch (int nFolder = :: GetPrivateProfileInt ( L" Settings " , L" UserRootFolder " , 0 , exeIniPath. c_str ()) ) {
69+ switch (nFolder) {
6970 case 1 :
71+ case 3 :
7072 refFolderId = FOLDERID_Profile; // ユーザーのルートフォルダー
7173 break ;
7274 case 2 :
7375 refFolderId = FOLDERID_Documents; // ユーザーのドキュメントフォルダー
7476 break ;
75- case 3 :
76- refFolderId = FOLDERID_Desktop; // ユーザーのデスクトップフォルダー
77- break ;
77+
7878 default :
7979 refFolderId = FOLDERID_RoamingAppData; // ユーザーのアプリケーションデータフォルダー
8080 break ;
8181 }
8282
8383 PWSTR pFolderPath = nullptr ;
84- ::SHGetKnownFolderPath (refFolderId, KF_FLAG_DEFAULT, nullptr , &pFolderPath);
84+ ::SHGetKnownFolderPath (refFolderId, KF_FLAG_DEFAULT_PATH, NULL , &pFolderPath);
8585 std::filesystem::path privateIniPath (pFolderPath);
8686 ::CoTaskMemFree (pFolderPath);
8787
@@ -92,6 +92,9 @@ std::filesystem::path CControlProcess::GetPrivateIniFileName(const std::wstring&
9292 {
9393 subFolder = L" sakura" ;
9494 }
95+ if (nFolder == 3 ) {
96+ privateIniPath.append (" Desktop" );
97+ }
9598 privateIniPath.append (subFolder);
9699
97100 if (const auto * pCommandLine = CCommandLine::getInstance (); pCommandLine->IsSetProfile () && *pCommandLine->GetProfileName ()) {
0 commit comments