Fix more queue regressions, use applescript to add files to iTunes.

This commit is contained in:
Damiano Galassi committed 2019-01-31 12:34:41 +01:00
1 parent 6d71efe9b4
commit 85494f3c57
9 files changed
+125 -66

No files matched your search

+10 -3
View File
@@ -264,9 +264,16 @@ class DocumentWindowController: NSWindowController, TracksViewControllerDelegate
private var sheetController: NSWindowController?
@IBAction func sendToExternalApp(_ sender: Any) {
let workspace = NSWorkspace.shared
if let filePath = doc.fileURL?.path, let appPath = workspace.fullPath(forApplication: "iTunes") {
workspace.openFile(filePath, withApplication: appPath)
if let filePath = doc.fileURL?.path, let script = NSAppleScript(source: """
tell application "iTunes" to add (POSIX file "\(filePath)")
""") {
let result = automationConsent(bundleIdentifier: "com.apple.iTunes", promptIfNeeded: true)
if result == .granted {
var error: NSDictionary?
script.executeAndReturnError(&error)
}
}
}