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 5fc37c5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
22 changes: 1 addition & 21 deletions NanaGet/NanaGetCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#undef GetObject

#include <winrt/Windows.ApplicationModel.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Storage.h>
#include <winrt/Windows.Storage.Streams.h>
Expand Down Expand Up @@ -132,7 +131,6 @@ namespace NanaGet

namespace winrt
{
using Windows::ApplicationModel::Package;
using Windows::Storage::ApplicationData;
using Windows::Storage::Streams::IBuffer;
using Windows::Web::Http::HttpResponseMessage;
Expand All @@ -155,24 +153,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 +171,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 5fc37c5

Please sign in to comment.