UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStarâ„¢
https://usdx.eu
GNU General Public License v2.0
832 stars 160 forks source link

Editor changes line endings when saving #32

Closed bohning closed 8 years ago

bohning commented 8 years ago

This is a cross-operating issue.

USDX for OSX seems to read text files with CRLF (Windows style) line endings fine, but changes them to LF (Mac style) when saving. This becomes a problem when trying to read that same file with USDX on Windows, as it does not recognize the LF line ending.

At least for me, this is a problem as I have my song collection on an external hard drive and sometimes play from a Windows machine, sometimes from a Mac.

My current workaround: I use Notepad++ with its "find in files" feature and look for LF without CR before it and replace it with CRLF.

basisbit commented 8 years ago

unix style lineendings should be supported by USDX 1.3 on windows without any issues. please confirm what version you use on windows

bohning commented 8 years ago

I can confirm that USDX 1.3 on Windows supports Unix style line endings. However, older versions of USDX (specifically the widespread CMD-Mod) does not, and thus this causes backwards compatibility issues. While this backwards compatibility may not be required in the future, the question still remains WHY the line endings are changed. If USDX 1.3 supports CRLF both on Mac and Windows, and older versions of USDX only support CRLF, why not always save them with CRLF?

basisbit commented 8 years ago

I guess this is caused by https://github.com/UltraStar-Deluxe/USDX/blob/master/src/base/UPath.pas#L1134 using an operating system specific definition of the line ending which are part of freepascal. This code wasn't touched for a long time and is compliant to the delphi definitions, so this issue must have existed for a long time already.

basisbit commented 8 years ago

this is fixed as of 3ca076f . Woud be great if some linux / os x user could test this. USDX will now always use "#13#10" / windows style linebreaks when saving txt files.

bohning commented 8 years ago

Great! I will try to test it as soon as I get to compiling it or a test version is available (whichever comes first). Thanks a bunch!