bchatard / alfred-jetbrains

Alfred5 workflow to easily open your projects with your favorite JetBrains product.
MIT License
618 stars 49 forks source link

Add toolbox script path to environment path #295

Closed imazine closed 1 year ago

imazine commented 1 year ago

Append toolbox script path to PATH variable This commit for fix #294

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

bchatard commented 1 year ago

Hi,

where are located your JetBrains binaries? In ${process.env.HOME}/Library/Application Support/JetBrains/Toolbox/scripts?

Per default it's /usr/local/bin and this path is available to $PATH with no additional configuration

imazine commented 1 year ago

@bchatard I am a Jetbrain Toolbox user and my binaries located in ~/Library/Application Support/Jetbrain/Toolbox/scripts It is default shell script location of toolbox. I suggest two solution for this issue. First is add a default script path(like this PR) and the other is add subtle guide for set a default shell script location to system default (e.g. /usr/loal/bin but It need to root permission)

image image
bchatard commented 1 year ago

Same for me, I'm using Toolbox since the beginning and scripts are still localized in ˋ/usr/local/binˋ. Maybe a change in fresh toolbox install. Anyway, did the script can be run in your terminal? Maybe you should add the path to your ˋ$PATHˋ in your ˋ~/.zshrcˋ.

imazine commented 1 year ago

@bchatard I guess your /usr/local/bin permission is not same with OS default(It is not writable without root permission). and I tried to change $PATH in my .zshrc configuration but It did not works.

image
bchatard commented 1 year ago

It was writable few months ago, so that the reason I use it.

Did you script works in your terminal? Eg: calling cd /path/to/projeect && idea .

imazine commented 1 year ago

@bchatard I can't find any reference about /usr/local/[sub_directories] changed to writable. If it was available then any application with user permission can change other binaries under the location. I guess your path was changed by yourself.

GertVil commented 1 year ago

Same issue here after using a new laptop, and idea in the terminal does work.

bchatard commented 1 year ago

Hi @GertVil

since the bin doesn't work in your terminal, the issue is not related to this workflow

GertVil commented 1 year ago

Hey @bchatard

You might have misread my original message, using idea in the terminal does in fact work

➜  /tmp mkdir test-project
➜  /tmp cd test-project
➜  test-project which idea
/Users/gert/Library/Application Support/JetBrains/Toolbox/scripts/idea
➜  test-project idea .
➜  test-project

and Intellij opens inside the test-project dir. I applied this MR locally, and it fixes the workflow. Default settings are the same as @imazine 's image

bchatard commented 1 year ago

Oups sorry

Can you try to echo your $PATH in Alfred script filter?

image image
GertVil commented 1 year ago

Yeah as per https://www.alfredapp.com/help/workflows/advanced/understanding-scripting-environment/ they differ my PATH in normal shell includes the /Users/gert/Library/Application Support/JetBrains/Toolbox/scripts and the echo in the script filter does not contain /Users/gert/Library/Application Support/JetBrains/Toolbox/scripts. Do you have objections to merging this PR? Because it would probably solve the issue for a lot of people without them having to adjust the path before the script runs. Since this is the new default location toolbox uses I'm guessing the problem will arise more and more.

bchatard commented 1 year ago

nice catch @GertVil

as a workaround I'll merge this