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

Bug fix: incorrect behavior when explorer hides file extension #28

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tpl2go
Copy link

@tpl2go tpl2go commented Jan 18, 2025

Use SHParseDisplayName to directly map filepath to PIDL instead of obtaining PIDLs of all files in folder

Use SHParseDisplayName to directly map filepath to PIDL instead of obtaining PIDLs of all files in folder
@tpl2go tpl2go marked this pull request as draft January 18, 2025 07:13
@tpl2go tpl2go marked this pull request as ready for review January 18, 2025 13:08
@tpl2go
Copy link
Author

tpl2go commented Jan 18, 2025

Hi @damonlynch, I think this PR should be ready. I tested that it works on Win10 and Win11. In the case when at least one filepath does not exist, an (unintuitive) exception TypeError: None is not a valid ITEMIDLIST in this context will be thrown. Would you prefer a different error handling behavior?

@damonlynch
Copy link
Owner

Hi @tpl2go , thank you very much. In the case of errors, I think it best to catch the exception for each error, such that:

  1. those that are error-free will be selected and opened in the file manager
  2. those that have a valid directory path, but an invalid file, will have the file manager open with the directory path only
  3. those that have an invalid directory path will simply open the file manager at its default location

The function should take the debug variable from the calling function show_in_file_manager, and if set, a message should be printed to sys.stderr that indicates the file and/or path is invalid.

What do you think?

@tpl2go
Copy link
Author

tpl2go commented Jan 19, 2025

hey @damonlynch! yup i think it is a good idea to catch the exception. Looking at the wsl side of the code in _process_path_or_uri_wsl it seems like filepaths that do not exists are dropped. I just wrote a commit that mirrors this behavior to the non-wsl function _process_path_or_uri_non_wsl. Doing this achieves (1) and (3).

If behavior (2) is desired, should the wsl side of the code also change? haha i understand that this is meant as a cross platform library so consistent behavior across platforms is important?

@damonlynch
Copy link
Owner

Sorry for not replying in a timely manner. My health has not been not great this past week. I will try to take a look at this in the next few days.

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.

2 participants