Skip to content

Commit

Permalink
Remove deprecated core plugins earlier to hopefully prevent a Sparkle…
Browse files Browse the repository at this point in the history
… crash as it checks for updates for plugins that no longer exist.

"This host [_.oecoreplugin] has no CFBundleVersion! This attribute is required."
  • Loading branch information
clobber committed Nov 4, 2017
1 parent 7d8e0e5 commit af1ecc7
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions OpenEmu/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ class AppDelegate: NSDocumentController {
override init() {

super.init()


// Needs to happen early to hopefully prevent a Sparkle crash.
removeDeprecatedPlugins()

// Load the XPC communicator framework. This used to be conditional on the existence of NSXPCConnection, but now OpenEmu's minimum supported version of macOS will always have NSXPCConnection.
let xpcFrameworkPath = (Bundle.main.privateFrameworksPath! as NSString).appendingPathComponent("OpenEmuXPCCommunicator.framework")
let xpcFrameworkBundle = Bundle(path: xpcFrameworkPath)
Expand Down Expand Up @@ -512,7 +515,23 @@ class AppDelegate: NSDocumentController {
}

// MARK: -


fileprivate func removeDeprecatedPlugins() {
// Remove deprecated core plugins.
let corePlugins = [
"NeoPop.oecoreplugin",
"TwoMbit.oecoreplugin",
"VisualBoyAdvance.oecoreplugin",
"Yabause.oecoreplugin"
]
let supportDirectoryURL = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).last!
let coresDirectoryURL = supportDirectoryURL.appendingPathComponent("OpenEmu/Cores")
for plugin in corePlugins {
let coreBundleURL = coresDirectoryURL.appendingPathComponent(plugin, isDirectory: false)
try? FileManager.default.removeItem(at: coreBundleURL)
}
}

fileprivate func removeInvalidPlugins() {

// Remove Higan WIP systems as defaults if found, since our core port does not support them.
Expand Down Expand Up @@ -546,20 +565,6 @@ class AppDelegate: NSDocumentController {
defaults.removeObject(forKey: "defaultCore.openemu.system.sms")
}

// Remove deprecated core plugins.
let corePlugins = [
"NeoPop.oecoreplugin",
"TwoMbit.oecoreplugin",
"VisualBoyAdvance.oecoreplugin",
"Yabause.oecoreplugin"
]
let supportDirectoryURL = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).last!
let coresDirectoryURL = supportDirectoryURL.appendingPathComponent("OpenEmu/Cores")
for plugin in corePlugins {
let coreBundleURL = coresDirectoryURL.appendingPathComponent(plugin, isDirectory: false)
try? FileManager.default.removeItem(at: coreBundleURL)
}

// Remove beta-era core plug-ins.
let betaPlugins = OECorePlugin.allPlugins.filter { ($0.infoDictionary["SUFeedURL"] as! String).contains("openemu.org/update") }
for plugin in betaPlugins {
Expand Down

0 comments on commit af1ecc7

Please sign in to comment.