-
Notifications
You must be signed in to change notification settings - Fork 37
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
Feature: Automatically add .exe when running on Windows. #281
Comments
Thing is, this is really hard to do generically. If there's interest, I could put together a PR that would key off const executableName(prefix: string): string => {
try {
Deno.statSync(prefix);
// hey it existed
return prefix;
} catch { /* don't care */ }
const pathext = Deno.env.get("PATHEXT").split(";");
for (const extension of pathext) {
try {
const name = `${prefix}${extension}`;
Deno.statSync(name);
return name;
} catch { /* continue */ }
}
}
An alternative would be to check just the exact path, the exact path with If any of that is a direction you want to go @dsherret, I'd be happy to put together a PR, but I think there's unfortunately a viable case to be made that dax should just require the exact executable name. |
Yes, using PATHEXT is the correct way to do this. |
Would you like me to put together a PR making this change? If so, would you want me to use raw Deno, |
It can just use raw Deno doing what you described. Thanks! |
I love that Dax lets me write cross-platforms scripts. One shortcoming, though, is in binary names.
As an example, if I run a
deno compile foo.ts
, I'd expect to then be able to run./foo
on the result.But, of course, on Windows, that file is
foo.exe
. I end up having to special case every time I want my Dax script to work in multiple places.It would be nice if this were automatic, or opt-in.
The text was updated successfully, but these errors were encountered: