OpenMPT: Correctly OS version gate the OpenMPT plugins, and add an interface for any other plugin to use, should it ever become necessary
parent
25a43a9083
commit
e2bca8f93b
|
@ -15,6 +15,10 @@
|
||||||
- (void)dealloc;
|
- (void)dealloc;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@protocol CogVersionCheck <NSObject>
|
||||||
|
+ (BOOL)shouldLoadForOSVersion:(NSOperatingSystemVersion)version;
|
||||||
|
@end
|
||||||
|
|
||||||
@protocol CogContainer <NSObject>
|
@protocol CogContainer <NSObject>
|
||||||
+ (NSArray *)fileTypes; //mp3, ogg, etc
|
+ (NSArray *)fileTypes; //mp3, ogg, etc
|
||||||
+ (NSArray *)mimeTypes;
|
+ (NSArray *)mimeTypes;
|
||||||
|
|
|
@ -67,6 +67,18 @@ static PluginController *sharedPluginController = nil;
|
||||||
- (void)bundleDidLoad:(NSNotification *)notification
|
- (void)bundleDidLoad:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
NSArray *classNames = [[notification userInfo] objectForKey:@"NSLoadedClasses"];
|
NSArray *classNames = [[notification userInfo] objectForKey:@"NSLoadedClasses"];
|
||||||
|
for (NSString *className in classNames)
|
||||||
|
{
|
||||||
|
Class bundleClass = NSClassFromString(className);
|
||||||
|
if ([bundleClass conformsToProtocol:@protocol(CogVersionCheck)]) {
|
||||||
|
DLog(@"Component has version check: %@", className);
|
||||||
|
if (![bundleClass shouldLoadForOSVersion:[[NSProcessInfo processInfo] operatingSystemVersion]])
|
||||||
|
{
|
||||||
|
DLog(@"Plugin fails OS version check, ignoring");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (NSString *className in classNames)
|
for (NSString *className in classNames)
|
||||||
{
|
{
|
||||||
DLog(@"Class loaded: %@", className);
|
DLog(@"Class loaded: %@", className);
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// OMPTVersionCheck.h
|
||||||
|
// OpenMPT
|
||||||
|
//
|
||||||
|
// Created by Christopher Snowhill on 12/27/21.
|
||||||
|
// Copyright © 2021 Christopher Snowhill. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OMPTVersionCheck_h
|
||||||
|
#define OMPTVersionCheck_h
|
||||||
|
|
||||||
|
#import "Plugin.h"
|
||||||
|
|
||||||
|
@interface OMPTOldVersionCheck : NSObject<CogVersionCheck>
|
||||||
|
+ (BOOL)shouldLoadForOSVersion:(NSOperatingSystemVersion)version;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* OMPTVersionCheck_h */
|
|
@ -0,0 +1,20 @@
|
||||||
|
//
|
||||||
|
// OMPTVersionCheck.m
|
||||||
|
// OpenMPT
|
||||||
|
//
|
||||||
|
// Created by Christopher Snowhill on 12/27/21.
|
||||||
|
// Copyright © 2021 Christopher Snowhill. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "OMPTVersionCheck.h"
|
||||||
|
|
||||||
|
@implementation OMPTOldVersionCheck
|
||||||
|
+ (BOOL)shouldLoadForOSVersion:(NSOperatingSystemVersion)version {
|
||||||
|
if (version.majorVersion < 10 ||
|
||||||
|
(version.majorVersion == 10 && version.minorVersion < 15))
|
||||||
|
return YES;
|
||||||
|
else
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
@end
|
|
@ -9,6 +9,7 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
83187C7120E4EAB700DED293 /* libOpenMPTOld.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPTOld.framework */; };
|
83187C7120E4EAB700DED293 /* libOpenMPTOld.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPTOld.framework */; };
|
||||||
83187C7220E4EAC400DED293 /* libOpenMPTOld.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPTOld.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
83187C7220E4EAC400DED293 /* libOpenMPTOld.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPTOld.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
|
8372349F277AA34000CD0A77 /* OMPTVersionCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 8372349D277AA34000CD0A77 /* OMPTVersionCheck.m */; };
|
||||||
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */; };
|
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */; };
|
||||||
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6F1FFF010B00659F0F /* OMPTContainer.mm */; };
|
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6F1FFF010B00659F0F /* OMPTContainer.mm */; };
|
||||||
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */; };
|
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */; };
|
||||||
|
@ -45,6 +46,8 @@
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
8372349D277AA34000CD0A77 /* OMPTVersionCheck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OMPTVersionCheck.m; path = OpenMPT/OMPTVersionCheck.m; sourceTree = "<group>"; };
|
||||||
|
8372349E277AA34000CD0A77 /* OMPTVersionCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OMPTVersionCheck.h; path = OpenMPT/OMPTVersionCheck.h; sourceTree = "<group>"; };
|
||||||
83E5EFA31FFEF78100659F0F /* OpenMPTOld.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenMPTOld.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
83E5EFA31FFEF78100659F0F /* OpenMPTOld.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenMPTOld.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
83E5EFA61FFEF78100659F0F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
83E5EFA61FFEF78100659F0F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
83E5EFC81FFEF7CC00659F0F /* libOpenMPTOld.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libOpenMPTOld.xcodeproj; path = ../../Frameworks/OpenMPT.old/libOpenMPTOld.xcodeproj; sourceTree = "<group>"; };
|
83E5EFC81FFEF7CC00659F0F /* libOpenMPTOld.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libOpenMPTOld.xcodeproj; path = ../../Frameworks/OpenMPT.old/libOpenMPTOld.xcodeproj; sourceTree = "<group>"; };
|
||||||
|
@ -125,6 +128,8 @@
|
||||||
83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */,
|
83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */,
|
||||||
83E5FE721FFF010C00659F0F /* OMPTMetadataReader.h */,
|
83E5FE721FFF010C00659F0F /* OMPTMetadataReader.h */,
|
||||||
83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */,
|
83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */,
|
||||||
|
8372349E277AA34000CD0A77 /* OMPTVersionCheck.h */,
|
||||||
|
8372349D277AA34000CD0A77 /* OMPTVersionCheck.m */,
|
||||||
);
|
);
|
||||||
name = Classes;
|
name = Classes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -216,6 +221,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */,
|
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */,
|
||||||
|
8372349F277AA34000CD0A77 /* OMPTVersionCheck.m in Sources */,
|
||||||
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */,
|
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */,
|
||||||
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */,
|
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
83187C7120E4EAB700DED293 /* libOpenMPT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPT.framework */; };
|
83187C7120E4EAB700DED293 /* libOpenMPT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPT.framework */; };
|
||||||
83187C7220E4EAC400DED293 /* libOpenMPT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPT.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
83187C7220E4EAC400DED293 /* libOpenMPT.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8308151E20E4EA96003ACEDA /* libOpenMPT.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
|
8372349C277AA23F00CD0A77 /* OMPTVersionCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 8372349B277AA23F00CD0A77 /* OMPTVersionCheck.m */; };
|
||||||
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */; };
|
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */; };
|
||||||
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6F1FFF010B00659F0F /* OMPTContainer.mm */; };
|
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE6F1FFF010B00659F0F /* OMPTContainer.mm */; };
|
||||||
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */; };
|
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */; };
|
||||||
|
@ -45,6 +46,8 @@
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
8372349A277AA1F600CD0A77 /* OMPTVersionCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OMPTVersionCheck.h; path = OpenMPT/OMPTVersionCheck.h; sourceTree = "<group>"; };
|
||||||
|
8372349B277AA23F00CD0A77 /* OMPTVersionCheck.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = OMPTVersionCheck.m; path = OpenMPT/OMPTVersionCheck.m; sourceTree = "<group>"; };
|
||||||
83E5EFA31FFEF78100659F0F /* OpenMPT.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenMPT.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
83E5EFA31FFEF78100659F0F /* OpenMPT.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenMPT.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
83E5EFA61FFEF78100659F0F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
83E5EFA61FFEF78100659F0F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
83E5EFC81FFEF7CC00659F0F /* libOpenMPT.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libOpenMPT.xcodeproj; path = ../../Frameworks/OpenMPT/libOpenMPT.xcodeproj; sourceTree = "<group>"; };
|
83E5EFC81FFEF7CC00659F0F /* libOpenMPT.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libOpenMPT.xcodeproj; path = ../../Frameworks/OpenMPT/libOpenMPT.xcodeproj; sourceTree = "<group>"; };
|
||||||
|
@ -125,6 +128,8 @@
|
||||||
83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */,
|
83E5FE6D1FFF010B00659F0F /* OMPTDecoder.mm */,
|
||||||
83E5FE721FFF010C00659F0F /* OMPTMetadataReader.h */,
|
83E5FE721FFF010C00659F0F /* OMPTMetadataReader.h */,
|
||||||
83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */,
|
83E5FE701FFF010C00659F0F /* OMPTMetadataReader.mm */,
|
||||||
|
8372349A277AA1F600CD0A77 /* OMPTVersionCheck.h */,
|
||||||
|
8372349B277AA23F00CD0A77 /* OMPTVersionCheck.m */,
|
||||||
);
|
);
|
||||||
name = Classes;
|
name = Classes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -216,6 +221,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */,
|
83E5FE751FFF010C00659F0F /* OMPTMetadataReader.mm in Sources */,
|
||||||
|
8372349C277AA23F00CD0A77 /* OMPTVersionCheck.m in Sources */,
|
||||||
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */,
|
83E5FE731FFF010C00659F0F /* OMPTDecoder.mm in Sources */,
|
||||||
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */,
|
83E5FE741FFF010C00659F0F /* OMPTContainer.mm in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// OMPTVersionCheck.h
|
||||||
|
// OpenMPT
|
||||||
|
//
|
||||||
|
// Created by Christopher Snowhill on 12/27/21.
|
||||||
|
// Copyright © 2021 Christopher Snowhill. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef OMPTVersionCheck_h
|
||||||
|
#define OMPTVersionCheck_h
|
||||||
|
|
||||||
|
#import "Plugin.h"
|
||||||
|
|
||||||
|
@interface OMPTVersionCheck : NSObject<CogVersionCheck>
|
||||||
|
+ (BOOL)shouldLoadForOSVersion:(NSOperatingSystemVersion)version;
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* OMPTVersionCheck_h */
|
|
@ -0,0 +1,20 @@
|
||||||
|
//
|
||||||
|
// OMPTVersionCheck.m
|
||||||
|
// OpenMPT
|
||||||
|
//
|
||||||
|
// Created by Christopher Snowhill on 12/27/21.
|
||||||
|
// Copyright © 2021 Christopher Snowhill. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "OMPTVersionCheck.h"
|
||||||
|
|
||||||
|
@implementation OMPTVersionCheck
|
||||||
|
+ (BOOL)shouldLoadForOSVersion:(NSOperatingSystemVersion)version {
|
||||||
|
if (version.majorVersion < 10 ||
|
||||||
|
(version.majorVersion == 10 && version.minorVersion < 15))
|
||||||
|
return NO;
|
||||||
|
else
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
@end
|
Loading…
Reference in New Issue