harryfei / which-rs

A Rust equivalent of Unix command "which".

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Find Windows exe's at reparse points

fdncred opened this issue · comments

On Windows 10, any file in c:\Users\<username>\AppData\Local\Microsoft\WindowsApps is in the Windows path. If you do a dir /aL there you can see that there are files that appear to have 0 byte file lengths. That is because they are all reparse points. It appears that which::which(name).is_ok() fails where name is one of these reparse point files. Are there any know work-arounds for this?

I've tried with which v3 and v4 and both fail. The error looks like this when I try to call winget.

error: Command not found
  ┌─ shell:1:1
  │
1 │ winget --help
  │ ^^^^^^ command not found

This is related to nushell/nushell#1935
Thanks.

I think it's this call here: https://github.com/harryfei/which-rs/blob/master/src/checker.rs#L42

Reparse points return error for 'metadata' but Ok for 'symlink_metadata'. See nushell/nushell#1935 (comment)

commented

Replacing metadata with symlink_metadata looks good to me. PR is welcome.

Added PR #23 to address this. Thanks to @thejpster for pointing it out.

commented

New version released.