@@ -624,6 +624,15 @@ Key=Value`;
624
624
assert (mimeAppsList.addedAssociations().appsForMimeType(" text/plain" ).equal([" geany.desktop" , " kde4-kwrite.desktop" ]));
625
625
assert (mimeAppsList.removedAssociations().appsForMimeType(" text/plain" ).equal([" libreoffice-writer.desktop" ]));
626
626
assert (mimeAppsList.defaultApplications().appsForMimeType(" x-scheme-handler/http" ).equal([" chromium.desktop" , " iceweasel.desktop" ]));
627
+
628
+ content =
629
+ ` [Default Applications]
630
+ text/plain=geany.desktop
631
+ notmimetype=value
632
+ ` ;
633
+ assertThrown! IniLikeReadException(new MimeAppsListFile (iniLikeStringReader(content)));
634
+ assertNotThrown(mimeAppsList = new MimeAppsListFile(iniLikeStringReader(content), null , IniLikeFile.ReadOptions(IniLikeGroup.InvalidKeyPolicy.save)));
635
+ assert (mimeAppsList.defaultApplications().value(" notmimetype" ) == " value" );
627
636
}
628
637
629
638
/**
@@ -665,7 +674,7 @@ final class MimeInfoCacheFile : IniLikeFile
665
674
*/
666
675
this (IniLikeReader)(IniLikeReader reader, string fileName = null , ReadOptions readOptions = ReadOptions.init)
667
676
{
668
- super (reader, fileName);
677
+ super (reader, fileName, readOptions );
669
678
_mimeCache = cast (MimeAppsGroup)group(" MIME Cache" );
670
679
enforce(_mimeCache ! is null , new IniLikeReadException(" No \" MIME Cache\" group" , 0 ));
671
680
}
@@ -721,6 +730,8 @@ text/plain=geany.desktop;
721
730
notmimetype=value
722
731
` ;
723
732
assertThrown! IniLikeReadException(new MimeInfoCacheFile (iniLikeStringReader(content)));
733
+ assertNotThrown(mimeInfoCache = new MimeInfoCacheFile(iniLikeStringReader(content), null , IniLikeFile.ReadOptions(IniLikeGroup.InvalidKeyPolicy.save)));
734
+ assert (mimeInfoCache.value(" notmimetype" ) == " value" );
724
735
}
725
736
726
737
/**
@@ -1101,7 +1112,7 @@ struct AssociationUpdateQuery
1101
1112
/**
1102
1113
* Apply query to MimeAppsListFile.
1103
1114
*/
1104
- void apply (MimeAppsListFile file) const
1115
+ @safe void apply(MimeAppsListFile file) const
1105
1116
{
1106
1117
foreach (op; _operations)
1107
1118
{
@@ -1147,7 +1158,7 @@ unittest
1147
1158
* Apply query for file with fileName. This should be mimeapps.list file.
1148
1159
* If file does not exist it will be created.
1149
1160
*/
1150
- void updateAssociations (string fileName, ref AssociationUpdateQuery query)
1161
+ @trusted void updateAssociations(string fileName, ref AssociationUpdateQuery query)
1151
1162
{
1152
1163
MimeAppsListFile file;
1153
1164
if (fileName.exists) {
@@ -1169,7 +1180,7 @@ static if (isFreedesktop)
1169
1180
* Developer can't guarantee yet that it will not damage your file associations settings.
1170
1181
* Note: This function is available only on freedesktop.
1171
1182
*/
1172
- void updateAssociations (ref AssociationUpdateQuery query)
1183
+ @safe void updateAssociations(ref AssociationUpdateQuery query)
1173
1184
{
1174
1185
foreach (fileName; writableMimeAppsListPaths ()) {
1175
1186
updateAssociations(fileName, query);
0 commit comments