I want to use the external external_command (Preferences -> Saving and Output) with placeholders (e.g. ${targetRoot}) under Windows 10 operating system to copy genetrated files to an other directory.
if I use:
cmd /c move /Y "${targetRoot}${fileName}" "C:\temp\"
the placeholders containing the wrong directory separator character ('/' instead on '\').
(tested with
cmd /c echo move /Y "${targetRoot}${fileName}" "C:\temp\" >>C:\temp\Logfile.txt
)
This could be read automatically from environment or set by an extra option.
Diff:
I can confirm that this is an issue with the commands you used. Some Windows shell commands can handle
/-delimited paths and some cannot:https://stackoverflow.com/a/10526678/448068
A workaround would be to use something other than
cmd/movethat can interpret the paths correctly, or wrap your entire operation in a script that can fix up the paths as appropriate.Last edit: Aaron Madlon-Kay 2020-02-29
I think this can be solved by using the canonical path when doing the variable expansion, as the
java.io.FileSystem.canonicalize(String)method recreates the path with the proper filesystem separator character.It's safer to do that just for the variable expansion since I suspect other part of the application rely on the path separator to be
/.canonicalizeactually hits the filesystem, which can be costly in some cases (hot loops, spinning disks, network drives). I think it's adequate to handle this textually, e.g.path.replace('/', File.separatorChar).Yes, I agree. And you're right; everything is normalized to
/for internal use.Last edit: Aaron Madlon-Kay 2020-02-29
Fixed in [0e89bf]
Related
Commit: [0e89bf]
Thank you, that’s perfect.
Diff:
Fixed in OmegaT 5.3.0.