1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-10 05:00:06 +02:00

🐛 Fix concurrency crashes with @objc methods

This commit is contained in:
2023-01-12 17:19:28 +01:00
parent 17efb50872
commit 3c6d2d74ff
2 changed files with 8 additions and 8 deletions

View File

@@ -33,8 +33,8 @@ class Application {
Attempt to open a specific directory in the app of choice. Attempt to open a specific directory in the app of choice.
(This will open the app if it isn't open yet.) (This will open the app if it isn't open yet.)
*/ */
@objc public func openDirectory(file: String) async { @objc public func openDirectory(file: String) {
return await Shell.quiet("/usr/bin/open -a \"\(name)\" \"\(file)\"") Task { await Shell.quiet("/usr/bin/open -a \"\(name)\" \"\(file)\"") }
} }
/** Checks if the app is installed. */ /** Checks if the app is installed. */

View File

@@ -30,17 +30,17 @@ extension DomainListVC {
NSWorkspace.shared.open(url) NSWorkspace.shared.open(url)
} }
@objc func openInFinder() async { @objc func openInFinder() {
await Shell.quiet("open '\(selectedSite!.absolutePath)'") Task { return await Shell.quiet("open '\(selectedSite!.absolutePath)'") }
} }
@objc func openInTerminal() async { @objc func openInTerminal() {
await Shell.quiet("open -b com.apple.terminal '\(selectedSite!.absolutePath)'") Task { await Shell.quiet("open -b com.apple.terminal '\(selectedSite!.absolutePath)'") }
} }
@objc func openWithEditor(sender: EditorMenuItem) async { @objc func openWithEditor(sender: EditorMenuItem) {
guard let editor = sender.editor else { return } guard let editor = sender.editor else { return }
await editor.openDirectory(file: selectedSite!.absolutePath) editor.openDirectory(file: selectedSite!.absolutePath)
} }
// MARK: - UI interaction // MARK: - UI interaction