From 087c6f14a8f7d4f0fd42e0e1a683f9ef9d2c24c4 Mon Sep 17 00:00:00 2001 From: MouriNaruto Date: Sun, 16 Jul 2023 00:34:49 +0800 Subject: [PATCH] Use Mile::WinRT::IsPackagedMode to simplify the implementation. --- NanaGet/NanaGetCore.cpp | 20 +------------------- NanaGet/NanaGetCore.h | 2 -- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/NanaGet/NanaGetCore.cpp b/NanaGet/NanaGetCore.cpp index b0d3af8..5fe992e 100644 --- a/NanaGet/NanaGetCore.cpp +++ b/NanaGet/NanaGetCore.cpp @@ -155,24 +155,6 @@ std::filesystem::path NanaGet::GetApplicationFolderPath() return CachedResult; } -bool NanaGet::IsPackagedMode() -{ - static bool CachedResult = ([]() -> bool - { - try - { - const auto CurrentPackage = winrt::Package::Current(); - return true; - } - catch (...) - { - return false; - } - }()); - - return CachedResult; -} - std::filesystem::path NanaGet::GetSettingsFolderPath() { static std::filesystem::path CachedResult = ([]() -> std::filesystem::path @@ -191,7 +173,7 @@ std::filesystem::path NanaGet::GetSettingsFolderPath() nullptr, &RawFolderPath)); FolderPath = std::filesystem::path(RawFolderPath); - if (!NanaGet::IsPackagedMode()) + if (!Mile::WinRT::IsPackagedMode()) { FolderPath /= L"M2-Team\\NanaGet"; } diff --git a/NanaGet/NanaGetCore.h b/NanaGet/NanaGetCore.h index 5d130da..720e785 100644 --- a/NanaGet/NanaGetCore.h +++ b/NanaGet/NanaGetCore.h @@ -39,8 +39,6 @@ namespace NanaGet { std::filesystem::path GetApplicationFolderPath(); - bool IsPackagedMode(); - std::filesystem::path GetSettingsFolderPath(); std::filesystem::path GetDownloadsFolderPath();