@@ -14,10 +14,14 @@ namespace UniGetUI.PackageEngine.Managers.WingetManager;
1414internal sealed class BundledWinGetHelper : IWinGetManagerHelper
1515{
1616 private readonly WinGet Manager ;
17+ private readonly string _cliExecutablePath ;
1718
18- public BundledWinGetHelper ( WinGet manager )
19+ public BundledWinGetHelper ( WinGet manager , string ? cliExecutablePath = null )
1920 {
2021 Manager = manager ;
22+ _cliExecutablePath = string . IsNullOrWhiteSpace ( cliExecutablePath )
23+ ? WinGet . BundledWinGetPath
24+ : cliExecutablePath ;
2125 }
2226
2327 public IReadOnlyList < Package > GetAvailableUpdates_UnSafe ( )
@@ -27,7 +31,7 @@ public IReadOnlyList<Package> GetAvailableUpdates_UnSafe()
2731 {
2832 StartInfo = new ( )
2933 {
30- FileName = WinGet . BundledWinGetPath ,
34+ FileName = _cliExecutablePath ,
3135 Arguments =
3236 Manager . Status . ExecutableCallArgs
3337 + " update --include-unknown --accept-source-agreements "
@@ -162,7 +166,7 @@ public IReadOnlyList<Package> GetInstalledPackages_UnSafe()
162166 {
163167 StartInfo = new ( )
164168 {
165- FileName = WinGet . BundledWinGetPath ,
169+ FileName = _cliExecutablePath ,
166170 Arguments =
167171 Manager . Status . ExecutableCallArgs
168172 + " list --accept-source-agreements "
@@ -294,7 +298,7 @@ public IReadOnlyList<Package> FindPackages_UnSafe(string query)
294298 {
295299 StartInfo = new ( )
296300 {
297- FileName = WinGet . BundledWinGetPath ,
301+ FileName = _cliExecutablePath ,
298302 Arguments =
299303 Manager . Status . ExecutableCallArgs
300304 + " search \" "
@@ -417,7 +421,7 @@ public void GetPackageDetails_UnSafe(IPackageDetails details)
417421 bool LocaleFound = true ;
418422 ProcessStartInfo startInfo = new ( )
419423 {
420- FileName = WinGet . BundledWinGetPath ,
424+ FileName = _cliExecutablePath ,
421425 Arguments =
422426 Manager . Status . ExecutableCallArgs
423427 + " show "
@@ -481,7 +485,7 @@ public void GetPackageDetails_UnSafe(IPackageDetails details)
481485 LocaleFound = true ;
482486 startInfo = new ( )
483487 {
484- FileName = WinGet . BundledWinGetPath ,
488+ FileName = _cliExecutablePath ,
485489 Arguments =
486490 Manager . Status . ExecutableCallArgs
487491 + " show "
@@ -539,7 +543,7 @@ public void GetPackageDetails_UnSafe(IPackageDetails details)
539543 process = new Process ( ) ;
540544 startInfo = new ( )
541545 {
542- FileName = WinGet . BundledWinGetPath ,
546+ FileName = _cliExecutablePath ,
543547 Arguments =
544548 Manager . Status . ExecutableCallArgs
545549 + " show "
@@ -714,7 +718,7 @@ public IReadOnlyList<string> GetInstallableVersions_Unsafe(IPackage package)
714718 {
715719 StartInfo = new ProcessStartInfo
716720 {
717- FileName = WinGet . BundledWinGetPath ,
721+ FileName = _cliExecutablePath ,
718722 Arguments =
719723 Manager . Status . ExecutableCallArgs
720724 + " show "
0 commit comments