# How to properly run json-format through cygwin?

**URL:** https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995
**Category:** The Toolbox
**Created:** [July 26, 2018, 11:45pm UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995 "2018-07-26T23:45:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![John\_Candlebury](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/john_candlebury/32/6437_2.png) [@John\_Candlebury](https://discourse.cataclysmdda.org/u/John_Candlebury)
#### Post date: [July 26, 2018, 11:45pm UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995/1 "2018-07-26T23:45:30Z")

</div>

I got the program compiled and everything. Its not an install problem.

It seems however that the formatter changes every file from using “LF” to “CR LF” line endings. As a result the formatter is mostly useless as it changes and is stopped by every json file in the directory.

Wanted to ask if someone has gotten the formatter to run properly in cygwin, what setting or anything else should I change?

---

<div class="post-metadata">

### Author: ![mlangsdorf](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/mlangsdorf/32/2462_2.png) [@mlangsdorf](https://discourse.cataclysmdda.org/u/mlangsdorf)
#### Post date: [July 27, 2018, 12:23am UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995/2 "2018-07-27T00:23:05Z")

</div>

Just a hack suggestion, but have you tried running dos2unix or unix2dos on the files before or after the formatter to get the files in the right format?

Also, what editor are you using? I `know` I just wrote the blazemod vehicle part descriptions using vim and notepad++ on Windows, screwed up the commit sequence, pushed the mangled commits up to GitHub, pulled them back down to a Linux box, rebased them the correct way with git gui, and submitted them without any CRLF issues.

Now, I strongly suspect I’ve configured my notepad++ and vim on Windows to use Unix style LFs and forgot about it, but my second step would be to check if you can get your editor to do the right thing.

---

<div class="post-metadata">

### Author: ![John\_Candlebury](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/john_candlebury/32/6437_2.png) [@John\_Candlebury](https://discourse.cataclysmdda.org/u/John_Candlebury)
#### Post date: [July 27, 2018, 1:38am UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995/3 "2018-07-27T01:38:29Z")

</div>

Yeah I just tried it, dos2unix works at reverting the change, thanks.

Im using notepad++ for editing. I think this shouldnt really matter, git should automatically change the CRLF to LF when commiting, thats what it says in .gitattributes at least.

Remaining problem is that the json formatter errors and stops everytime it chages a file (in this case it changes everyfile) so I have to run it a bazillion times before it actually reaches and formats the files that interest me. Any way around this?

---

<div class="post-metadata">

### Author: ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)
#### Post date: [July 27, 2018, 6:43am UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995/4 "2018-07-27T06:43:18Z")

</div>

You need to update formatter code, like I did in [https://github.com/CleverRaven/Cataclysm-DDA/commit/892f56fcf4581881363a4d13241c67edea539ab6](https://github.com/CleverRaven/Cataclysm-DDA/commit/892f56fcf4581881363a4d13241c67edea539ab6), but with some MinGW flag.

---

<div class="post-metadata">

### Author: ![John\_Candlebury](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/john_candlebury/32/6437_2.png) [@John\_Candlebury](https://discourse.cataclysmdda.org/u/John_Candlebury)
#### Post date: [July 27, 2018, 12:50pm UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995/5 "2018-07-27T12:50:28Z")

</div>

Thanks Zhilkin!

Can I run only the formatter using MSYS, without needing to compile the whole game?

If yes I’ll rather just change to MSYS2

Edit: Nevermind I gave your PR a poper read, the answer is yes

---

<div class="post-metadata">

### Author: ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)
#### Post date: [July 27, 2018, 1:16pm UTC](https://discourse.cataclysmdda.org/t/how-to-properly-run-json-format-through-cygwin/15995/6 "2018-07-27T13:16:35Z")

</div>

Sure. You can use MSYS for running format only, but I suggest using MSYS for compilation too using my recent instruction - [https://github.com/CleverRaven/Cataclysm-DDA/blob/master/COMPILING-MSYS.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/COMPILING-MSYS.md).

I am interested in updating MinGW instruction too, but didn’t take time to look into it yet. I guess it won’t be different much from MSYS.
