Hello, I have a project that builds some smaller modules into shared libraries, and then copies those DLL files to the same folder as the final executable. I'm having trouble copying those libraries on windows when they are nested in subfolders.
Here is a minimal project that illustrates the issue:
> dir /B /S
> more a\b\c
> more Tupfile
: a/b/c |> copy %f %o |> d/e/f
Attempting to build this results in the following:
tup error: failed to create child process: No such file or directory
It took me some time to figure out that copy is not actually an exe file that exists in the PATH, but is instead a built in command. I had to change the Tupfile to run the command inside cmd:
: a/b/c |> cmd /c copy %f %o |> d/e/f
Now copy runs but it doesn't work properly because I'm using the wrong slashes. I tried another change:
: a\b\c |> cmd /c copy %f %o |> d\e\f
But tup invokes my command like this:
cmd /c copy a\b/c d\e\f
Which understandably prints out "The syntax of the command is incorrect.". I don't really fault tup for this or expect it to support the ugly windows slashes, but this could also be a bug, not sure. At this point I think I'm stuck. Questions/thoughts:
- Am I doing something wrong? Is there an easier way to do this on windows or a way to work around it? I could maybe install some packages (wsl/msys) that provide a sane unix cp, but I'm distributing this to others and would prefer it to minimize its dependencies.
- Should tup run commands inside a shell on windows? I saw that there was a COMSPEC environment variable that has the path to cmd.exe, maybe that would be useful.
- I see that errno is used to try to provide better error messages when commands fail on windows, but perhaps this could be expanded. I was stuck on the "no such file or directory" message for a while because I thought the paths provided to the copy command were invalid.
- Is this indeed an issue with path separators on windows?
I can submit pull requests for some of this stuff if that's helpful.