microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.69k stars 1.41k forks source link

I have set the "portablePackageUserRoot", but winget still install on default root under user scope #2483

Closed Michaelzhouisnotwhite closed 1 year ago

Michaelzhouisnotwhite commented 1 year ago

Brief description of your issue

I set "portablePackageUserRoot": "%LOCALAPPDATA%/WingetPackages". Then I use command : winget install --id Fndroid.ClashForWindows --scope user --source winget. The protablePagageUserRoot settings didn't affect. It still installed under %LOCALAPPDATA%/Programs. I must specify --location everytime when I install packages.

The protablePackageMachineRoot didn't work as well. What did I miss?

Steps to reproduce

winget settings

set "portablePackageUserRoot": "%LOCALAPPDATA%/WingetPackages"

winget install --id Fndroid.ClashForWindows --scope user --source winget

Expected behavior

The program will install under "%LOCALAPPDATA%/WingetPackages"

Actual behavior

The program install under "%LOCALAPPDATA%\Programs"

Environment

⮞ winget --info
Windows 程序包管理器 v1.3.1872
版权所有 (C) Microsoft Corporation。保留所有权利。

Windows: Windows.Desktop v10.0.22622.586
系统体系结构: X64
程序包: Microsoft.DesktopAppInstaller v1.18.1872.0
ItzLevvie commented 1 year ago

portablePackageUserRoot and portablePackageMachineRoot only works for portable executable files.

Fndroid.ClashForWindows uses full-fledged installers based on NSIS (nullsoft) so this won't work. See https://github.com/microsoft/winget-pkgs/blob/master/manifests/f/Fndroid/ClashForWindows/0.19.29/Fndroid.ClashForWindows.installer.yaml#L15-L51

There's also defaultInstallRoot but taking a look at https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md#default-install-root it's only for packages that requires it.

Michaelzhouisnotwhite commented 1 year ago

It's so weird. I hope the installation will installed on the protableuserRoot based on my settings by specifying --scope user argument, that I don't have to use --location every single time. This is not very logical