Closed Argent77 closed 6 years ago
I don't think this is WeiDU. After manually converting fl_functions.tpa to CRLF, I can't reproduce this on either of my Windows build systems (OCaml 4.01 and an older toolchain and 4.05 and a bit more recent toolchain).
I could track the issue to scripts/make_tph.ml
, which generates src/tph.ml
with the invalid \r\r\n line breaks.
With my meager OCaml knowledge I have managed to remove all \r instances from the buffer in the load_file
function. The resulting src/tph.ml
still contained single \r instances which suggests that a subsequent operation (maybe Printf.fprintf
from main()
) converts \n to \r\n on Windows.
Btw, I'm using OCaml 4.02.3 (32-bit) from there: http://protz.github.io/ocaml-installer/
Not that it matters much, but I would guess it's the channel opened by open_out that does a naive native conversion on line endings. OCaml policy, as such, is that line-ends are converted into LF on read and into native on write*. I would guess it's your OCaml distribution that's doing it.
*Except when it isn't. The Unix module does, or, at least, did, not, and this is what load_file
uses to read.
For reference, my 4.05 is from here: https://fdopen.github.io/opam-repository-mingw/installation/ and my 4.01 is from a distribution that was discontinued before the one you are using was discontinued.
Second edit: 4.02 will also be too old if I fix the deprecated functions from the String module. Those were deprecated in 4.03. But I don't think I have to do that now; they are, to my knowledge, not (yet) build-blocking.
Seems to be a local issue. Closing.
If script files in
src/tph/*/
contain Windows-style line breaks during the build process, the resulting WeiDU executable will fail to install mods with the following error:Apparently the build process adds a second CR before LF (on Windows), which WeiDU's parser doesn't like.
This issue makes working with WeiDU sources on Windows difficult, since
git
automatically converts line breaks to CRLF by default.