Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Add installation path to PATH env" function #4008

Closed
soredake opened this issue Dec 26, 2023 · 7 comments
Closed

"Add installation path to PATH env" function #4008

soredake opened this issue Dec 26, 2023 · 7 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@soredake
Copy link

soredake commented Dec 26, 2023

Description of the new feature / enhancement

There is some software that install cli version's but do not modify PATH env, it's not realistic to expect that every installer will be updated to modify, therefore having such function in winget will be nice.

Example packages that have cli version's but don't add installation path to PATH env so you can't use them out of the box:
proxinject
7-Zip-zstd
7zip
this issue have many more example of such software #549

Proposed technical implementation details

Example for proxinject package:

Installers:
- Architecture: x64
  InstallerUrl: https://github.com/PragmaTwice/proxinject/releases/download/v0.5.0-pre/proxinjectSetup-v0.5.0-pre-x64.exe
  InstallerSha256: 9F8D33D6FEAE2D3042D01F129204318885178A9363EA9AAF468FABE9F4E2F9E2
  AddToPath: $env:APPDATA\proxinject | <INSTALLPATH>

AddToPath should only work in Silent or SilentWithProgress modes as user can modify installation path in interactive mode and winget will add wrong path to env.

If user is not specified --location argument it will use default value $env:APPDATA\proxinject otherwise it will add <INSTALLPATH> to PATH

@soredake soredake added the Issue-Feature This is a feature request for the Windows Package Manager client. label Dec 26, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Dec 26, 2023
@Trenly
Copy link
Contributor

Trenly commented Dec 26, 2023

What if an installer doesn’t write to $env:APPDATA and <INSTALLPATH> isn’t set?

@soredake
Copy link
Author

@Trenly then it will not work, yes.

@stephengillie stephengillie added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Issue-Feature This is a feature request for the Windows Package Manager client. Needs-Triage Issue need to be triaged labels Dec 27, 2023
@stephengillie
Copy link

I believe this functionality might already exist within the client.

@lesleyrs
Copy link

Winget did install some cli tools to PATH for me, but sharkdp.bat and sharkdp.fd are 2 that didn't get added automatically even though they also got installed to AppData\Local\Microsoft\WinGet\Packages just like the others. IDK what the problem is though.

@denelon
Copy link
Contributor

denelon commented Jan 3, 2024

WinGet isn't going to take action to modify environment variables like the path unless it's a portable package where WinGet is logically acting as an installer. There is too much risk of undesired behavior, and if the package is uninstalled, it could lead to dead path entries.

It might be worth adding installation notes to manifests for those packages so users can be informed what action they need to take.

@denelon denelon closed this as completed Jan 3, 2024
@denelon denelon added this to the v1.7 Client milestone Jan 3, 2024
@sohang3112
Copy link

WinGet isn't going to take action to modify environment variables like the path

@denelon if it's not going to add to the environment path, at least it can tell what the executable path is so that it can be added to environment path manually!

For example, pip also warns while installing packages if install path is not in environment path.

@HeitorAugustoLN
Copy link

@denelon Adding the feature to add the installation to PATH during installation is very important for some portable applications. For example, when I created a manifest file for Dart it had some issues such as the ‘Failed to start the Dart CLI isolate (null)’ error when trying to run it. However, when I manually added the installation path to the system environment PATH, it worked flawlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

7 participants