Skip to content

Launches atlassian Sourcetree.app (naming collision) #72

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

Closed
counterbeing opened this issue Aug 24, 2022 · 5 comments · Fixed by #76
Closed

Launches atlassian Sourcetree.app (naming collision) #72

counterbeing opened this issue Aug 24, 2022 · 5 comments · Fixed by #76

Comments

@counterbeing
Copy link

On my system, there is a binary present called stree which is for opening the sourcetree app. I know this app has been around for quite some time, and this isn't an invention of mine. I'm just imagining that there might be a lot of people with an stree binary already on their system.

Upon installing the app, it opened up the sourcetree app in five different directories on my system. I'm wondering if there's some way to detect the appropriate binary by default?

I've gotten it working by manually configuring the path to the gem, and it seems to be great! I just don't want this naming collision to possibly hamper adoption.

Thanks so much!
Cory

@counterbeing
Copy link
Author

P.S. Just left the very first review in the VSCode marketplace ;)

@kddnewton
Copy link
Member

kddnewton commented Aug 25, 2022

Interesting @counterbeing! I had no idea that stree would end up conflicting.

We do supply the ability to specify the path, but I agree that that's not a great default experience. I'm thinking we could probably inspect the PATH environment variable ourselves and do something smart. For example, we could find all of the path entries that contain "ruby" in the name.

Try something for me. If you run the following program, does path get set to the right executable?

path =
  ENV["PATH"].split(":").detect do |directory|
    executable = File.join(directory, "stree")
    break executable if directory.include?("ruby") && File.exists?(executable)
  end

@kddnewton
Copy link
Member

@counterbeing I opened up a PR I think will fix this, but want to verify this first, so let me know if you get a chance to run that.

@counterbeing
Copy link
Author

That does appear to return a path!

❯ irb
irb(main):001:0* path =
irb(main):002:1*   ENV["PATH"].split(":").detect do |directory|
irb(main):003:1*     executable = File.join(directory, "stree")
irb(main):004:1*     break executable if directory.include?("ruby") && File.exists?(executable)
irb(main):005:0>   end
=> "/Users/cory/.asdf/installs/ruby/3.0.3/bin/stree"

I suppose the other thing worth noting is that I'm running my ruby under asdf as my version manager. But, yes, this appears to work. This shell was running a version of ruby that actually didn't have syntax_tree installed, and I got nil, which seems like expected behavior. Then I installed a copy of the gem in this ruby version, and it popped out as expected.

@kddnewton
Copy link
Member

This should be out in v0.5.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants