-
Notifications
You must be signed in to change notification settings - Fork 215
Proposing a fix for the FOR /F syntax in sy[ncany].bat #270
Comments
Firstly, thanks for your contribution! |
You're welcome. It's rather a Windows' shell issue, Microsoft's ”built-in“ CMD or a vastly compatible replacement, TakeCommand. So it's awkward batch scripting rather than bash scripting. I've not yet reached a comprehensive glance over the repository's structure, but I assume the code I relate to be buried in the Gradle build system – which I know very little of. So I'd suggest some of the guys involved in that part of the project QA-testing my patch and applying it ”by hand“. No credits needed. |
I just hate that we still have batch files. They're the worst... For the GUI it's even worse: .lnk starts .vbs which starts a .bat which then runs the JVM. Horrible combination... |
It is indeed embedded deep into gradle -- we're basically patching the batch file that gradle creates. |
wow that's indeed very ugly :D |
@xax You can download the latest snapshot (in 10 minutes or so) from here, once Travis is done building: |
Works on two Windows PCs. I now consider this fixed. |
In the NT batch file serving as cli proxy, the line
for /F tokens^=2^,3^,5delims^=^<^"^=^> %%a in (%APP_USERCONFIG_FILE%) do (
throws an error, if the batch file is run under TCC (TakeCommand windows shell replacement by JP-Soft).
This is due to the hackish make up of the
<options>
string following the/F
switch.According to
CMD.EXE
's documentation, the string must be enclosed in double quotes (I recognize, you tried to avoid that by not using separating spaces and escaping the special characters). So this hack doesn't only break TCC compatibility, but is not valid CMD-Syntax, either.Using the ”delayed expansion“ enhanced feature of CMD (enabled in the
SETLOCAL
command, if not already enabled), you can avoid the hack using a temporary environment variable to contain a single double quote character, that gets delayed-expanded as an argument to thedelimiter=
option ofFOR /F
. And that way TCC (and its users) are satisfied, too.This is the diff:
The text was updated successfully, but these errors were encountered: