Skip to content

Commit

Permalink
Simplify default source type retrieval in PackageManager
Browse files Browse the repository at this point in the history
- Integrate the fix from "Fix for Source Argument Validation in SourceWorkflow for Default Source Type" (microsoft#4891). This commit incorporates part of the included fix for consistency.
- Updated the method of obtaining the default source type in the
winrt::Microsoft::Management::Deployment::implementation namespace
within PackageManager.cpp. Replaced the use of
::AppInstaller::Repository::ISourceFactory::GetForType("")->TypeName()
with ::AppInstaller::Repository::Source::GetDefaultSourceType().

This
change simplifies the process and ensures future-proofing against any
changes in the SourceFactory's default type.
  • Loading branch information
Madhusudhan-MSFT committed Oct 21, 2024
1 parent e1902d9 commit 127b4c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.Management.Deployment/PackageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,8 @@ namespace winrt::Microsoft::Management::Deployment::implementation
if (sourceType.empty())
{
// This method of obtaining the default source type is slightly expensive as it requires creating a SourceFactory object
// and fetching the type name.Nonetheless, it future - proofs the code against any changes in the SourceFactory's default type.
sourceType = ::AppInstaller::Repository::ISourceFactory::GetForType("")->TypeName();
// and fetching the type name.Nonetheless, it future-proofs the code against any changes in the SourceFactory's default type.
sourceType = ::AppInstaller::Repository::Source::GetDefaultSourceType();
}

for (const auto& source : sourceList)
Expand Down

0 comments on commit 127b4c7

Please sign in to comment.