Skip to content

Commit

Permalink
[ContextMenu]Update win11 msix menus if wrong version is detected (#3…
Browse files Browse the repository at this point in the history
…7289)

* [ContextMenus]Update win11 msix menus if wrong version

* Remove extra line in code
  • Loading branch information
jaimecbernardo authored Feb 9, 2025
1 parent 1205a9d commit 33ec492
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/common/utils/package.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <winrt/Windows.Management.Deployment.h>

#include "../logger/logger.h"
#include "../version/version.h"

namespace package {
inline BOOL IsWin11OrGreater()
Expand Down Expand Up @@ -47,10 +48,14 @@ namespace package {
for (auto const& package : packageManager.FindPackagesForUser({}))
{
const auto& packageFullName = std::wstring{ package.Id().FullName() };
const auto& packageVersion = package.Id().Version();

if (packageFullName.contains(packageDisplayName))
{
return true;
if (packageVersion.Major == VERSION_MAJOR && packageVersion.Minor == VERSION_MINOR && packageVersion.Revision == VERSION_REVISION)
{
return true;
}
}
}

Expand All @@ -72,6 +77,7 @@ namespace package {
// Declare use of an external location
AddPackageOptions options;
options.ExternalLocationUri(externalUri);
options.ForceUpdateFromAnyVersion(true);

IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> deploymentOperation = packageManager.AddPackageByUriAsync(packageUri, options);
deploymentOperation.get();
Expand Down

0 comments on commit 33ec492

Please sign in to comment.