-
Notifications
You must be signed in to change notification settings - Fork 575
Description
I was trying the Shebang Recipes function and got this error:
C:\Users\hyrious\Desktop\Sakuna>just ruby
error: Could not find `cygpath` executable to translate recipe `ruby` shebang interpreter path:
program not found
This was because I do not have cygpath
in my PATH. I do have cygpath.exe in the installation directory of Git and MSYS2, but they are not added to PATH for not polluting my normal shell. For example, PowerShell would prefer echo.exe
(from bash) over the echo
command, they behave differently obviously.
While the most complete solution may be quite complex regarding to #1549 and #2599. I have a more trivial feature request that, just
can search for cygpath.exe
from common paths like a relative path to Git:
C:\Users\hyrious\Desktop\Sakuna>C:\progra~1\Git\usr\bin\cygpath --version
cygpath (cygwin) 3.4.10
Path Conversion Utility
Copyright (C) 1998 - 2024 Cygwin Authors
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\Users\hyrious\Desktop\Sakuna>C:\progra~1\Git\usr\bin\cygpath ruby
ruby
The basic logic is as follows:
-
See if
C:\progra~1\Git\usr\bin\cygpath.exe
exists. This is the default location that Git for Windows will be installed at. It is highly possible that there's acygpath.exe
. -
If not, search for
git.exe
bywhere git
or simply iterating over the PATH environment. -
If
git
exists, resolve thecygpath
byjoin(git_path, '../../usr/bin/cygpath.exe')
.> fs.existsSync(path.join(String.raw`C:\Progra~1\Git\cmd\git.exe`, '../../usr/bin/cygpath.exe')) true
You're free to choose not to implement that.