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

Shell open can't open file if the file is being used by a program on Windows #1003

Closed
Legend-Master opened this issue Feb 29, 2024 · 4 comments

Comments

@Legend-Master
Copy link
Contributor

Legend-Master commented Feb 29, 2024

open from shell plugin can't open file if the file is being used by a program on Windows, for example, the log file from the log plugin

We're currently using open to handle open files in shell plugin, and this is a bug in that crate

Some(program) => ::open::with_detached(path, program),

I have discussed with the author of open on Byron/open-rs#90 and we both think maybe it's better to use opener (this crate is used by rustup by the way) for this case

But this crate doesn't support open with specific program, so maybe if we still want to support that, we can use opener for handling default open, and open for open with specific program

Another added benefit is that we can add reveal from opener, as it's a highly requested feature #999

Opens the default file explorer and reveals a file or folder in its containing folder.

@amrbashir
Copy link
Member

I kind of disagree with the author that ShellExecuteW shouldn't be used in open-rs since they have a with_detached method and ShellExecuteW would be perfect for that usecase.

Anyways, I don't want to switch to opener as it is currently using (sorta?) unmaintained crates winapi and dbus and our use-case is simple.

I think I will switch our windows implementation to use ShellExecuteW and keep using open-rs on other platforms.

Also #999 is currently being worked on in https://github.com/tauri-apps/plugins-workspace/tree/feat/shell-show-item-in-dir

@Byron
Copy link

Byron commented Feb 29, 2024

Would you be willing to contribute the ShellExecuteW version to open if you think it can fit?

Your usecase would be reason enough to even consider some standalone-windows-only-special-case that can be used for exactly these occasions. Making open able to actually open things is important to me, and supporting tauri in any way even more so.

@amrbashir
Copy link
Member

Thank you for considering, I personally would like to keep using open as it has minimal dependencies and have been covering our simple use-case for so long.

Would you be willing to contribute the ShellExecuteW version to open if you think it can fit?

yes, I can open a PR sometime later

@Legend-Master
Copy link
Contributor Author

Legend-Master commented Mar 1, 2024

Anyways, I don't want to switch to opener as it is currently using (sorta?) unmaintained crates winapi and dbus and our use-case is simple.

There's a hanging PR on switching to windows crate Seeker14491/opener#28

Anyway, if we can support this in open, that'll be great as open has way fewer dependencies

Also #999 is currently being worked on in https://github.com/tauri-apps/plugins-workspace/tree/feat/shell-show-item-in-dir

It's great to see it being worked on!

amrbashir added a commit that referenced this issue Mar 4, 2024
amrbashir added a commit that referenced this issue Mar 4, 2024
* chore(deps): update to `open-rs@5.1`

ref: #1003

* changefile
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

3 participants