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

implement non-EXE support #89

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elijah-wright
Copy link

@elijah-wright elijah-wright commented Jun 9, 2024

this PR adds non-EXE support by running ShellExecute with the default application for files. I'm not familiar with AssocQueryStringW, so this should not be merged until someone who does know that function can look through it. invoking AssocQueryStringW twice, first to get buffer_size and then to fill the buffer, doesn't seem elegant

I tested this on Windows 10 with sudo support. text files appeared to work, but any other file did not, likely due to some strange behavior with programs in locations with a space as defined in shell/open/command. it may work on Windows 11, I have a machine I can test this on, but until that's fixed this shouldn't be merged

if !is_exe {
req.args
.splice(0..0, [req.application.clone()]);
req.application = get_default_application(&req.application).expect("Failed to get the default application");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might fail if a file doesn't have a file association with it. the standard behavior (non-sudo) is to open the open with prompt, so this might have to be changed before being merged

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 this pull request may close these issues.

1 participant