Skip to content

Commit 6a03dbc

Browse files
committed
Fix GH#23898: Make MS recognize the .mscz~ filetype
build upon musescore#31352
1 parent 2f7edde commit 6a03dbc

File tree

4 files changed

+26
-43
lines changed

4 files changed

+26
-43
lines changed

buildscripts/packaging/Linux+BSD/musescore.xml.in

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,11 @@
4242

4343
<mime-type type="application/x-musescore">
4444
<comment>MuseScore compressed backup score</comment>
45-
<glob pattern="*.mscz,"/>
45+
<glob pattern="*.mscz~"/>
4646
<sub-class-of type="application/zip"/>
4747
<icon name="application-x-musescore@MUSE_APP_INSTALL_SUFFIX@"/>
4848
</mime-type>
4949

50-
<mime-type type="application/x-musescore+xml">
51-
<comment>MuseScore uncompressed backup score</comment>
52-
<glob pattern="*.mscx,"/>
53-
<sub-class-of type="application/xml"/>
54-
<root-XML namespaceURI="" localName="museScore"/>
55-
<icon name="application-x-musescore@MUSE_APP_INSTALL_SUFFIX@+xml"/>
56-
<magic>
57-
<match type="string" value="&lt;?xml" offset="0">
58-
<match type="string" value="&lt;museScore" offset="0:128">
59-
<match type="string" value="&lt;Score" offset="0:512"/>
60-
</match>
61-
</match>
62-
</magic>
63-
</mime-type>
64-
6550
<!-- MuseScore URL Protocol -->
6651

6752
<mime-type type="x-scheme-handler/musescore">

buildscripts/packaging/Windows/Installer/WIX.template.in

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<RegistryValue Name=".mscz" Value="MuseScore.mscz.$(var.ProgIdSuffix)" Type="string" />
8484
<RegistryValue Name=".mscx" Value="MuseScore.mscx.$(var.ProgIdSuffix)" Type="string" />
8585
<RegistryValue Name=".mscs" Value="MuseScore.mscs.$(var.ProgIdSuffix)" Type="string" />
86+
<RegistryValue Name=".mscz~" Value="MuseScore.mscz.$(var.ProgIdSuffix)" Type="string" />
8687
<!-- TODO: Add other file types here too? -->
8788
</RegistryKey>
8889

@@ -115,6 +116,7 @@
115116
<RegistryValue Name=".mscz" Value="" Type="string" />
116117
<RegistryValue Name=".mscx" Value="" Type="string" />
117118
<RegistryValue Name=".mscs" Value="" Type="string" />
119+
<RegistryValue Name=".mscz~" Value="" Type="string" />
118120
<RegistryValue Name=".xml" Value="" Type="string" />
119121
<RegistryValue Name=".musicxml" Value="" Type="string" />
120122
<RegistryValue Name=".mxl" Value="" Type="string" />
@@ -200,6 +202,23 @@
200202
<RegistryValue Name="Content Type" Value="application/x-musescore+xml" Type="string" />
201203
</RegistryKey>
202204

205+
<!-- MSCZ~ -->
206+
<RegistryKey Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.mscz~.$(var.ProgIdSuffix)">
207+
<RegistryValue Value="MuseScore Backup File" Type="string" />
208+
<RegistryValue Key="DefaultIcon" Value="[INSTALL_ROOT]bin\$(var.ExeName),1" Type="string" />
209+
<RegistryValue Key="shell\open\command" Value="&quot;[INSTALL_ROOT]bin\$(var.ExeName)&quot; &quot;%1&quot;" Type="string" />
210+
</RegistryKey>
211+
<?ifndef MUSE_APP_IS_PRERELEASE?>
212+
<RegistryValue Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.mscz~\CurVer" Value="MuseScore.mscz~.$(var.ProgIdSuffix)" Type="string" />
213+
<?endif?>
214+
215+
<RegistryKey Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\.mscz~">
216+
<?ifndef MUSE_APP_IS_PRERELEASE?>
217+
<RegistryValue Value="MuseScore.mscz~.$(var.ProgIdSuffix)" Type="string" />
218+
<?endif?>
219+
<RegistryValue Name="Content Type" Value="application/x-musescore+xml" Type="string" />
220+
</RegistryKey>
221+
203222
<!-- musescore URL scheme -->
204223
<RegistryKey Root="$(var.RegistryRoot)" Key="SOFTWARE\Classes\MuseScore.Url.musescore.$(var.ProgIdSuffix)">
205224
<RegistryValue Value="MuseScore URL" Type="string" />

buildscripts/packaging/macOS/Info.plist.in

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,38 +96,14 @@
9696
<dict>
9797
<key>public.filename-extension</key>
9898
<array>
99-
<string>mscz,</string>
99+
<string>mscz~</string>
100100
</array>
101101
<key>public.mime-type</key>
102102
<array>
103103
<string>application/x-musescore</string>
104104
</array>
105105
</dict>
106106
</dict>
107-
<dict>
108-
<key>UTTypeIdentifier</key>
109-
<string>org.musescore.mscx,</string>
110-
<key>UTTypeDescription</key>
111-
<string>MuseScore Uncompressed Backup File</string>
112-
<key>UTTypeIconFile</key>
113-
<string>MscxIcon.icns</string>
114-
<key>UTTypeConformsTo</key>
115-
<array>
116-
<string>public.data</string>
117-
<string>public.content</string>
118-
</array>
119-
<key>UTTypeTagSpecification</key>
120-
<dict>
121-
<key>public.filename-extension</key>
122-
<array>
123-
<string>mscx,</string>
124-
</array>
125-
<key>public.mime-type</key>
126-
<array>
127-
<string>application/x-musescore+xml</string>
128-
</array>
129-
</dict>
130-
</dict>
131107
</array>
132108
<key>CFBundleDocumentTypes</key>
133109
<array>

src/engraving/infrastructure/mscio.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ namespace mu::engraving {
3030
//! NOTE The main format is MuseScore, is a zip archive with a specific structure
3131
static const std::string MSCZ = "mscz";
3232

33+
//! NOTE This is the automatically generated backup file.
34+
static const std::string MSCZ_BACKUP = "mscz~";
35+
3336
//! NOTE Before MuseScore 4, MuseScore could save data in one xml file (excluding binary) with `.mscx` extension.
3437
//! Starting from MuseScore 4, only the score domain model store to the `.mscx` file,
3538
//! and other data, such as styles, chordlist, synthesizer settings, etc. are stored in separate files.
@@ -46,7 +49,7 @@ static const std::string MSCS = "mscs";
4649

4750
inline bool isMuseScoreFile(const std::string& suffix)
4851
{
49-
return suffix == MSCZ || suffix == MSCX || suffix == MSCS;
52+
return suffix == MSCZ || suffix == MSCX || suffix == MSCS || suffix == MSCZ_BACKUP;
5053
}
5154

5255
enum class MscIoMode : unsigned char {
@@ -58,7 +61,7 @@ enum class MscIoMode : unsigned char {
5861

5962
inline MscIoMode mscIoModeBySuffix(const std::string& suffix)
6063
{
61-
if (suffix == MSCZ) {
64+
if (suffix == MSCZ || suffix == MSCZ_BACKUP) {
6265
return MscIoMode::Zip;
6366
} else if (suffix == MSCX) {
6467
return MscIoMode::Dir;

0 commit comments

Comments
 (0)