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

open::with() fails due to app not found #80

Closed
igdswzcd opened this issue Jun 19, 2023 · 1 comment
Closed

open::with() fails due to app not found #80

igdswzcd opened this issue Jun 19, 2023 · 1 comment

Comments

@igdswzcd
Copy link

  • Version: 4.1.0
  • System: Windows 10/11

I want to open .avif images by Google Chrome.
Since it doesn't have a default viewer, and I don't want to tell users how to set default opener, So I use open::with() by passing "chrome" as the second param.
It fails whether I pass "Google Chrome" or "chrome", I looked into source code and found that open::with() runs shell like this:

cmd /c chrome "C:\example.avif"

I never set chrome's path as an env path, so it surely can't execute by cmd.
However, the start cmd in open::that() works. I tried such cmd below and it worked.

cmd /c start chrome "C:\example.avif"

And I modified code in cargo and it also worked in my app. Other apps in this case: msedge, wordpad, WINWORD, etc.

So I wonder could open::with() also use start to call specific app since we don't usually set app's path as env path in Windows? Or should there be another function use start command and specific app at same time?

Byron added a commit that referenced this issue Jun 21, 2023
…in the program to open with. (#80)

This is helpful when testing new features around the `with()` function.
@Byron
Copy link
Owner

Byron commented Jun 21, 2023

You seem to have found an "incantation" that works for you on Windows and I'd hope this could also work here without breaking others - something I'd be most anxious about. However, it's definitely worth a try, it's just an innocent start snuck in.

Please feel free to open a PR to give it a try.

igdswzcd pushed a commit to igdswzcd/open-rs that referenced this issue Jun 25, 2023
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

No branches or pull requests

2 participants