Skip to content

Commit

Permalink
Merge 128f442 into 91a09d7
Browse files Browse the repository at this point in the history
  • Loading branch information
berryzplus authored Sep 10, 2022
2 parents 91a09d7 + 128f442 commit 23fe59e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sakura_core/_main/CControlProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ std::filesystem::path CControlProcess::GetIniFileName() const
*/
std::filesystem::path CControlProcess::GetPrivateIniFileName(const std::wstring& exeIniPath, const std::wstring& filename) const
{
const auto nFolder = ::GetPrivateProfileInt(L"Settings", L"UserRootFolder", 0, exeIniPath.c_str());
KNOWNFOLDERID refFolderId;
switch (int nFolder = ::GetPrivateProfileInt(L"Settings", L"UserRootFolder", 0, exeIniPath.c_str())) {
switch (nFolder) {
case 1:
case 3:
refFolderId = FOLDERID_Profile; // ユーザーのルートフォルダー
break;
case 2:
refFolderId = FOLDERID_Documents; // ユーザーのドキュメントフォルダー
break;
case 3:
refFolderId = FOLDERID_Desktop; // ユーザーのデスクトップフォルダー
break;

default:
refFolderId = FOLDERID_RoamingAppData; // ユーザーのアプリケーションデータフォルダー
break;
}

PWSTR pFolderPath = nullptr;
::SHGetKnownFolderPath(refFolderId, KF_FLAG_DEFAULT, nullptr, &pFolderPath);
::SHGetKnownFolderPath(refFolderId, KF_FLAG_DEFAULT_PATH, NULL, &pFolderPath);
std::filesystem::path privateIniPath(pFolderPath);
::CoTaskMemFree(pFolderPath);

Expand All @@ -92,6 +92,9 @@ std::filesystem::path CControlProcess::GetPrivateIniFileName(const std::wstring&
{
subFolder = L"sakura";
}
if (nFolder == 3) {
privateIniPath.append("Desktop");
}
privateIniPath.append(subFolder);

if (const auto* pCommandLine = CCommandLine::getInstance(); pCommandLine->IsSetProfile() && *pCommandLine->GetProfileName()) {
Expand Down

0 comments on commit 23fe59e

Please sign in to comment.