QDir::separator() vs. "/"
The current code uses QDir::separator()
in a few places, but "/"
in a lot other places.
While the former might be the correct way for being platform independant, the latter should work too, and in some cases even better.
See https://doc.qt.io/qt-5/qdir.html#separator and http://agateau.com/2015/qdir-separator-considered-harmful/
We should go one or the other way, this wild mixture should not stay. And either way, it should get documented in the developers' handbook's coding style and in mscore3.txt.
My (current ;-)) opinion: go for "/"
, it is the leaner change and as per the above links better and guaranteed to work on all platforms.
QDir::separator()
is used twice in MuseScore::exportParts()
, in ResourceManager::downloadLanguage()
, and (now) in ResourceManager::downloadExtension()
and 3 times in thirdparty/gzip/qzip.cpp, MQZipReader::extractAllFiles()
.
Maybe we don't want to touch thirdparty/gzip/qzip.cpp and/or get that fixed upstream, but ResourceManager::downloadLanguage()
uses MQZipReader (at least MQZipReader::FileInfo()
), not sure that matters.
Comments
decision on IRC was to change to "/", except for 3rd party, and on master only. Will provide a PR later
Developers' handbook updated, see https://musescore.org/en/handbook/developers-handbook/finding-your-way-…
See https://github.com/musescore/MuseScore/pull/3785
Fixed in branch master, commit a96dfec86a
Fix #273963: Use `"/"` rather than `QDir::separator()` for pathnames
Fixed in branch master, commit c86296853d
Merge pull request #3785 from Jojo-Schmitz/QDir--separator()
Fix #273963: Use `"/"` rather than `QDir::separator()` for pathnames
Fixed in branch master, commit cf9fc61f0a
Fix #273963: Use slash rather than 'QDir::separator()' for pathnames
Automatically closed -- issue fixed for 2 weeks with no activity.