You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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
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:I never set chrome's path as an env path, so it surely can't execute by cmd.
However, the
start
cmd inopen::that()
works. I tried such cmd below and it worked.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 usestart
to call specific app since we don't usually set app's path as env path in Windows? Or should there be another function usestart
command and specific app at same time?The text was updated successfully, but these errors were encountered: