Skip to content

Modifying the command search mechanism under Windows #170

Answered by jpco
hyphenrf asked this question in Q&A
Discussion options

You must be logged in to vote

The quick answer: %pathsearch is the function you want to override. I'm not so familiar with WSL so there might be some gotchas I don't know about, but a somewhat quick-and-dirty override might look like:

let (ps = $fn-%pathsearch)
fn %pathsearch name {
	catch @ e {
		catch @ e2 {
			throw $e
		} {
			$ps $name^.exe
		}
	} {
		$ps $name
	}
}

There's a little nuance with this that you might want to figure out for yourself. For example, if you have a path of /bin /usr/bin, and your system has both a /bin/foo.exe and a /usr/bin/foo, which of those two binaries do you want returned for foo? That said, this should be an okay start.


More in-depth technical discussion follows.

In es, every com…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by hyphenrf
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants