Program not found on windows
OS: Windows 10 Version 21H2 Shell: PowerShell 7
The following commands do not work:
- mkdir
- cp
- mv
- rm
For example the command mv results in these log entries:
08:59:14.569 [INFO] broot::verb::external_execution: Executing not leaving, launchable Program { exe: "mv", args: ["C:\\temp\\test.csv", "C:\\temp/test2.csv"], working_dir: None, capture_mouse: true }
08:59:14.570 [DEBUG] broot::launchable: working_dir: None
08:59:14.581 [WARN] broot::verb::external_execution: launchable failed : LaunchError { program: "mv", source: Error { kind: NotFound, message: "program not found" } }
Can you try to define verbs with complete paths to the programs ?
Something like
{
invocation: "md {subpath}"
external: ["c:/path/to/mkdir.exe", "-p", "{directory}/{subpath}"]
}
I think the correct default should be to use Windows command https://www.lemoda.net/windows/windows2unix/windows2unix.html for powershell at least. (thus mkdir should work)
@Canop Yes that works fine
I think the main problem is, that in Windows there is no such thing as mkdir.exe. As far as I understand it, in PowerShell mkdir is just an alias for the the New-Item function and in the classic CMD box mkdir is a built in function of the CMD box.
Two possible workarounds come to my mind:
With git for Windows there comes a bunch of .exe files (like mkdir.exe, cp.exe, mv.exe) located under:
c:\Program Files\Git\usr\bin\
If you add this directory to your path then this might work (I have to test this)
Another way would be to start the cmd.exe and pass the command to execute to it.
For example:
cmd.exe /c mkdir test123
And as a verb it would look like this:
{
invocation: "md {subpath}"
external: "cmd /c mkdir {subpath}"
leave_broot: false
}
We could define all built-in internals like ["cmd", "/c", "mkdir", "{subpath}"] on Windows, for example with #[cfg] attributes in there.
But I can't do that myself as I don't have a Windows computer to try.
Can somebody make a well tested PR for this? Is it even a reliable solution ?
We could define all built-in internals like
["cmd", "/c", "mkdir", "{subpath}"]on Windows, for example with#[cfg]attributes in there.
Some commands do have other names in the cmd.exe. For example there is no rm, there is del (for files) and rmdir (for directories).
I made some example verbs in my config that work at first glance, but they have to be tested further.
{
key: F5
invocation: "cp"
external: "cmd /c copy /Y {file} {other-panel-directory}"
leave_broot: false
}
{
key: F6
invocation: "mv"
external: "cmd /c move /Y {file} {other-panel-directory}"
leave_broot: false
}
{
invocation: "md {subpath}"
external: "cmd /c mkdir {subpath}"
leave_broot: false
}
{
key: F8
apply_to: "file"
invocation: "rm"
external: "cmd /c del /Q /S {file}"
leave_broot: false
}
{
key: F8
apply_to: "directory"
invocation: "rm"
external: "cmd /c rmdir /Q /S {file}"
leave_broot: false
}
Can somebody make a well tested PR for this?
Maybe I have a look at it on the weekend, but my Rust is at "Hello World" level 😄
Is it even a reliable solution ?
That is the key question, maybe there is a better solution than calling cmd.exe.