summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-03-03 15:30:20 +0100
committerder richter <der.richter@gmx.de>2024-03-07 01:03:52 +0100
commitcb807ff063739fbbdc2a0f702916d16c9ca713e5 (patch)
tree5e9e427ecd97f3abd6c16f87f719383f58dde12d
parent996ec6fecaedc96cc6bd6076c05f07628f82b4ad (diff)
downloadmpv-cb807ff063739fbbdc2a0f702916d16c9ca713e5.tar.bz2
mpv-cb807ff063739fbbdc2a0f702916d16c9ca713e5.tar.xz
mac/menu: replace deprecated openFile() usage
-rw-r--r--osdep/mac/menu_bar.swift16
1 files changed, 8 insertions, 8 deletions
diff --git a/osdep/mac/menu_bar.swift b/osdep/mac/menu_bar.swift
index c2de6ac319..d8158598a1 100644
--- a/osdep/mac/menu_bar.swift
+++ b/osdep/mac/menu_bar.swift
@@ -298,24 +298,24 @@ class MenuBar: NSObject {
@objc func preferences(_ menuItem: NSMenuItem) {
guard let menuConfig = getConfigFromMenu(menuItem: menuItem),
let fileName = menuConfig.file else { return }
- let configPaths: [String] = [
- NSHomeDirectory() + "/.config/mpv/",
- NSHomeDirectory() + "/.mpv/",
+ let configPaths: [URL] = [
+ URL(fileURLWithPath: NSHomeDirectory() + "/.config/mpv/", isDirectory: true),
+ URL(fileURLWithPath: NSHomeDirectory() + "/.mpv/", isDirectory: true),
]
for path in configPaths {
- let configFile = path + fileName
+ let configFile = path.appendingPathComponent(fileName, isDirectory: false)
- if FileManager.default.fileExists(atPath: configFile) {
- if NSWorkspace.shared.openFile(configFile) {
+ if FileManager.default.fileExists(atPath: configFile.path) {
+ if NSWorkspace.shared.open(configFile) {
return
}
- NSWorkspace.shared.openFile(path)
+ NSWorkspace.shared.open(path)
alert(title: "No Application found to open your config file.", text: "Please open the \(fileName) file with your preferred text editor in the now open folder to edit your config.")
return
}
- if NSWorkspace.shared.openFile(path) {
+ if NSWorkspace.shared.open(path) {
alert(title: "No config file found.", text: "Please create a \(fileName) file with your preferred text editor in the now open folder.")
return
}