Skip to content

Commit

Permalink
Use Mile::WinRT::IsPackagedMode to simplify the implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed Jul 15, 2023
1 parent e3e8c58 commit 087c6f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
20 changes: 1 addition & 19 deletions NanaGet/NanaGetCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";
}
Expand Down
2 changes: 0 additions & 2 deletions NanaGet/NanaGetCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ namespace NanaGet
{
std::filesystem::path GetApplicationFolderPath();

bool IsPackagedMode();

std::filesystem::path GetSettingsFolderPath();

std::filesystem::path GetDownloadsFolderPath();
Expand Down

0 comments on commit 087c6f1

Please sign in to comment.