I have an issue, and I'd like some guidance on how to solve this. I have this single line of code:
writeFile("copy.jpg", readFile("nim_in_action_cover.jpg"))
This is the image
Under linux, a simple nim c -r Main.nim makes a copy as expected, now if a cross-compile it to windows and run it with wine: nim c -d:mingw --cpu:i386 Main && wine Main Makes the picture lose 2KB in the process and now is broken:
ExifTool Version Number : 11.63
ExifTool Version Number : 11.63
File Name : copy.jpg
Directory : .
File Size : 71 kB
File Modification Date/Time : 2019:09:26 12:43:38+02:00
File Access Date/Time : 2019:09:26 12:43:45+02:00
File Inode Change Date/Time : 2019:09:26 12:43:38+02:00
File Permissions : rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Warning : JPEG format error
Is this an issue with wine or a bug related to how nim cross-compiles code (CR/LF)?Yes, the NULL character (00) appears to be missing. Weird because I have used wine for other software that opens files too and had zero issues. I tried using fread and I get the same result. It reads exactly the same amount of bytes, but the 00s are removed.
So it must be some bug in wine, who knows.