From 41e741a9d9473fddf5d528aaafd90e326adf4c48 Mon Sep 17 00:00:00 2001 From: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com> Date: Wed, 4 May 2022 16:04:27 -0700 Subject: [PATCH] Fix packageId and sourceId match check for portable install (#2138) --- src/AppInstallerCLICore/Workflows/PortableInstallFlow.cpp | 2 +- src/AppInstallerCommonCore/PortableARPEntry.cpp | 1 + src/AppInstallerCommonCore/Public/winget/PortableARPEntry.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AppInstallerCLICore/Workflows/PortableInstallFlow.cpp b/src/AppInstallerCLICore/Workflows/PortableInstallFlow.cpp index 6e7f0f0618..09599290e9 100644 --- a/src/AppInstallerCLICore/Workflows/PortableInstallFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/PortableInstallFlow.cpp @@ -233,7 +233,7 @@ namespace AppInstaller::CLI::Workflow if(uninstallEntry.Exists()) { - if (uninstallEntry.IsSamePortablePackageEntry(packageIdentifier, sourceIdentifier)) + if (!uninstallEntry.IsSamePortablePackageEntry(packageIdentifier, sourceIdentifier)) { // TODO: Replace HashOverride with --Force when argument behavior gets updated. if (!context.Args.Contains(Execution::Args::Type::HashOverride)) diff --git a/src/AppInstallerCommonCore/PortableARPEntry.cpp b/src/AppInstallerCommonCore/PortableARPEntry.cpp index ba31a073f5..6b47814b4e 100644 --- a/src/AppInstallerCommonCore/PortableARPEntry.cpp +++ b/src/AppInstallerCommonCore/PortableARPEntry.cpp @@ -62,6 +62,7 @@ namespace AppInstaller::Registry::Portable } else { + m_exists = false; m_key = Key::Create(root, subKey); } } diff --git a/src/AppInstallerCommonCore/Public/winget/PortableARPEntry.h b/src/AppInstallerCommonCore/Public/winget/PortableARPEntry.h index 8b4de60a23..5c3757502c 100644 --- a/src/AppInstallerCommonCore/Public/winget/PortableARPEntry.h +++ b/src/AppInstallerCommonCore/Public/winget/PortableARPEntry.h @@ -44,7 +44,7 @@ namespace AppInstaller::Registry::Portable Registry::Key GetKey() { return m_key; }; private: - bool m_exists; + bool m_exists = false; Key m_key; };