File tree Expand file tree Collapse file tree
UniGetUI.PackageEngine.Managers.WinGet
UniGetUI.PackageEngine.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -386,10 +386,15 @@ Func<string, bool> fileExists
386386 }
387387
388388 internal IWinGetManagerHelper CreateCliHelperForSelectedCliTool ( )
389+ {
390+ return CreateCliHelperForSelectedCliTool ( Status . ExecutablePath ) ;
391+ }
392+
393+ internal IWinGetManagerHelper CreateCliHelperForSelectedCliTool ( string executablePath )
389394 {
390395 return SelectedCliToolKind == WinGetCliToolKind . BundledPinget
391- ? new PingetCliHelper ( this , Status . ExecutablePath )
392- : new WinGetCliHelper ( this , Status . ExecutablePath ) ;
396+ ? new PingetCliHelper ( this , executablePath )
397+ : new WinGetCliHelper ( this , executablePath ) ;
393398 }
394399
395400 protected override void _loadManagerExecutableFile (
@@ -449,7 +454,7 @@ ex is WinGetComActivationException activationEx
449454 }
450455
451456 Logger . Warn ( "WinGet will resort to using WinGetCliHelper()" ) ;
452- WinGetHelper . Instance = CreateCliHelperForSelectedCliTool ( ) ;
457+ WinGetHelper . Instance = CreateCliHelperForSelectedCliTool ( path ) ;
453458 }
454459 }
455460
Original file line number Diff line number Diff line change @@ -500,6 +500,25 @@ public void ShouldUseWinGetComApiNeverUsesComForBundledPingetCliTool()
500500 ) ;
501501 }
502502
503+ [ Fact ]
504+ public void CreateCliHelperForSelectedCliToolUsesExplicitExecutablePath ( )
505+ {
506+ var manager = new WinGet ( ) ;
507+ SetCliToolKind ( manager , WinGetCliToolKind . SystemWinGet ) ;
508+
509+ IWinGetManagerHelper helper = manager . CreateCliHelperForSelectedCliTool (
510+ @"C:\WindowsApps\winget.exe"
511+ ) ;
512+
513+ var pathField = typeof ( WinGetCliHelper ) . GetField (
514+ "_cliExecutablePath" ,
515+ System . Reflection . BindingFlags . Instance | System . Reflection . BindingFlags . NonPublic
516+ ) ;
517+
518+ Assert . NotNull ( pathField ) ;
519+ Assert . Equal ( @"C:\WindowsApps\winget.exe" , pathField . GetValue ( helper ) ) ;
520+ }
521+
503522 [ Fact ]
504523 public void NativeWinGetHelperUsesSystemCliFallbackForInstalledPackagesWhenCompositeCatalogFails ( )
505524 {
You can’t perform that action at this time.
0 commit comments