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

"--shimgen-usetargetworkingdirectory" as default argument #128

Open
cosmomill opened this issue Apr 26, 2016 · 8 comments
Open

"--shimgen-usetargetworkingdirectory" as default argument #128

cosmomill opened this issue Apr 26, 2016 · 8 comments
Labels

Comments

@cosmomill
Copy link

cosmomill commented Apr 26, 2016

It would be very useful to create executables with --shimgen-usetargetworkingdirectory as default argument. Cause many so-called portable apps expecting the config file in the current working directory. E.g. the executable for Regshot in $env:ChocolateyInstall\bin\Regshot-x64-Unicode.exe can't find the regshot.ini if not executed in $env:ChocolateyInstall\lib\regshot\tools\. So you always have to run $env:ChocolateyInstall\bin\Regshot-x64-Unicode.exe --shimgen-usetargetworkingdirectory to start Regshot. The WOX launcher is another example which creates an image directory in the current working directory. It would be great to have these applications in the $PATH.

┆Issue is synchronized with this Gitlab issue by Unito

@ferventcoder
Copy link
Member

While I appreciate that you believe this should be the default, let's talk a little more about how shimgen works so I can get an understanding of why.

  • When a shim runs, it runs from the $env:ChocolateyInstall\bin path. The working directory for the shim is your current directory.
  • The shim starts the binary it represents in the actual location it exists. The working directory is still the current directory you are in.
  • Most executables are able to find everything surrounding the actual executable that must exist for it to work appropriately, including config files.

There are a few that are badly behaved executables that require that you are actually in the folder where they exist to run them. That literally means you can not have them in the PATH and execute them from anywhere on the system, you can only go to the directory where they are located and execute them from there. --use-targetworkingdirectory overcomes this issue allowing you to execute them from anywhere.

There are some GUI applications that are set to be run from the executable directory as the working directory in the start menu. I wonder if this is what you are running into?

I also wonder if it would make sense to be able to provide an option to a shim to have it always start with arguments you want it to?

And also a way to provide this option as part of creating shims for these badly behaved apps?

@cosmomill
Copy link
Author

Thank you for your fast and detailed response.

There are some GUI applications that are set to be run from the executable directory as the working directory in the start menu. I wonder if this is what you are running into?

That's not the issue, I think it's uncommon to create shim's for "install" packages.

I also wonder if it would make sense to be able to provide an option to a shim to have it always start with arguments you want it to?

And also a way to provide this option as part of creating shims for these badly behaved apps?

I think one outstanding feature of Chocolatey is the possibility to have all executables in the PATH without polluting it. Furthermore Chocolatey automatically create these executables for packages in $env:ChocolateyInstall\lib\. I would like to have the option to create working shim's for these badly behaved executables. I think of an argument like --gui which sets --shimgen-gui as default argument for the resulting shim.

@ferventcoder
Copy link
Member

I would like to have the option to create working shim's for these badly behaved executables. I think of an argument like --gui which sets --shimgen-gui as default argument for the resulting shim.

The 0.9.10 beta version of shimgen automatically determines it is a GUI and sets it appropriately without the need for a .gui file.

@ferventcoder
Copy link
Member

ferventcoder commented Apr 26, 2016

I think one outstanding feature of Chocolatey is the possibility to have all executables in the PATH without polluting it.

I'm guessing you are saying this feature is great, not that it still needs this feature? If so, we think so as well.

@ferventcoder
Copy link
Member

I would like to have the option to create working shim's for these badly behaved executables.

I agree.

@ferventcoder
Copy link
Member

But I also like a consumer call to adjust the default behavior of a shim.

@cosmomill
Copy link
Author

But I also like a consumer call to adjust the default behavior of a shim.

I can only serve you with a "Feature Request" 😉
Thanks for your time.

@gep13 gep13 transferred this issue from chocolatey/shimgen Feb 24, 2022
@gep13
Copy link
Member

gep13 commented Feb 24, 2022

Based on some changes happening to the Chocolatey repositories, this issue has been moved from the chocolatey/shimgen repository to the chocolatey/home repository.

@gep13 gep13 added the shimgen label Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants