Custom instruments.xml not read if not with Unix-style line endings (regardless of OS)
It is difficult for me to properly document this issue as I have a Linux system and this may affect the results. Anyway:
Context: latest github commit under Linux Mint 17 (myself) and at least one Windows system running some recent beta or nightly. The Windows system is not mine, but of another user, as it can be gathered from this post and this post .
Steps:
1) Prepare and save to disk a custom version of instruments.xml; the precise modification is not relevant, as long as it can be detected from the instrument lists while running MuseScore (for instance change the spelling of an instrument name). It is important to make sure that the file is saved with Unix-style line endings (CR)
2) Start MuseScore and point "Edit | Preferences", tab "Score", item "Instrument list 1" to the custom instruments.xml file.
3) Close and restart MuseScore
4) Check in the instrument list that the custom file is actually loaded
5) Close MuseScore
6) Change the custom instruments.xml file to have Windows-style line endings (CR LF)
7) Restart MuseScore
Result: the custom instruments.xml file is NOT loaded; the built-in default is used instead. Note that both Linux and Windows systems require the Unix line endings, then this is not dependent from the system, but from the XML reader / parser.
Expected result: the line ending should not matter while reading an XML file.
Comments
What about using also the flag
QIODevice::Text
when reading the file (in OR with QIODevice::ReadOnly)?http://doc.qt.io/qt-5/qiodevice.html#OpenModeFlag-enum
If I understood the code correctly, I think this flag could be used at line 631 of libmscore/instrtemplate.cpp.
https://github.com/musescore/MuseScore/blob/master/libmscore/instrtempl…
Bingo! Preparing a PR...
PR submitted: https://github.com/musescore/MuseScore/pull/1726
Would the same be needed for reading other text files, like .album, .mss, .qml, .drm, etc. ?
#4: I don't know; perhaps it would not do harm... OTOH, I think instruments.xml it is the only one which a user may want to customize and, while doing so, convert to the line ending style of his system (by choice or by accident).
Fixed in 88f0b02db3
Automatically closed -- issue fixed for 2 weeks with no activity.