Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/AppInstallerCLICore/PortableInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ namespace AppInstaller::CLI::Portable
return true;
}

void PortableInstaller::Install( Workflow::OperationType operation = Workflow::OperationType::Install)
void PortableInstaller::Install(Workflow::OperationType operation)
{
// If the operation is an install, the ARP entry should be created first so that a catastrophic failure
// leaves the system in a state where an uninstall may be possible
Expand Down Expand Up @@ -420,6 +420,19 @@ namespace AppInstaller::CLI::Portable
HelpLink = manifest.CurrentLocalization.Get<Manifest::Localization::PublisherSupportUrl>();
}

AppInstaller::Manifest::AppsAndFeaturesEntry PortableInstaller::GetAppsAndFeaturesEntry()
{
Manifest::AppsAndFeaturesEntry entry;

entry.DisplayName = DisplayName;
entry.Publisher = Publisher;
entry.DisplayVersion = DisplayVersion;
entry.InstallerType = Manifest::InstallerTypeEnum::Portable;
entry.ProductCode = GetProductCode();

return entry;
}

void PortableInstaller::SetExpectedState()
{
const auto& indexPath = InstallLocation / GetPortableIndexFileName();
Expand Down
4 changes: 3 additions & 1 deletion src/AppInstallerCLICore/PortableInstaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace AppInstaller::CLI::Portable
m_desiredEntries = {};
}

void Install( AppInstaller::CLI::Workflow::OperationType operation );
void Install(AppInstaller::CLI::Workflow::OperationType operation = Workflow::OperationType::Install);

void Uninstall();

Expand Down Expand Up @@ -91,6 +91,8 @@ namespace AppInstaller::CLI::Portable
const Manifest::Manifest& manifest,
const std::vector<AppInstaller::Manifest::AppsAndFeaturesEntry>& entries);

AppInstaller::Manifest::AppsAndFeaturesEntry GetAppsAndFeaturesEntry();

private:
PortableARPEntry m_portableARPEntry;
std::vector<AppInstaller::Portable::PortableFileEntry> m_desiredEntries;
Expand Down
5 changes: 3 additions & 2 deletions src/AppInstallerCLICore/Workflows/PortableFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ namespace AppInstaller::CLI::Workflow
}

portableInstaller.TargetInstallLocation = targetInstallDirectory;
portableInstaller.SetAppsAndFeaturesMetadata(context.Get<Execution::Data::Manifest>(), context.Get<Execution::Data::Installer>()->AppsAndFeaturesEntries);
portableInstaller.SetAppsAndFeaturesMetadata(context.Get<Execution::Data::Manifest>(), installer.AppsAndFeaturesEntries);
context.Add<Execution::Data::PortableInstaller>(std::move(portableInstaller));
}

Expand Down Expand Up @@ -273,7 +273,8 @@ namespace AppInstaller::CLI::Workflow
}
}

portableInstaller.Install(installType);
portableInstaller.Install(installType);
context.Add<Execution::Data::CorrelatedAppsAndFeaturesEntries>({ portableInstaller.GetAppsAndFeaturesEntry() });
context.Add<Execution::Data::OperationReturnCode>(ERROR_SUCCESS);
context.Reporter.Warn() << portableInstaller.GetOutputMessage();
}
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLITests/PortableInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ TEST_CASE("PortableInstaller_InstallToRegistry", "[PortableInstaller]")

portableInstaller.Install(AppInstaller::CLI::Workflow::OperationType::Install);

auto entry = portableInstaller.GetAppsAndFeaturesEntry();
REQUIRE(entry.ProductCode == portableInstaller.GetProductCode());

PortableInstaller portableInstaller2 = PortableInstaller(ScopeEnum::User, Architecture::X64, "testProductCode");
REQUIRE(portableInstaller2.ARPEntryExists());
REQUIRE(std::filesystem::exists(portableInstaller2.PortableTargetFullPath));
Expand Down