-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d90d902
commit 595828b
Showing
6 changed files
with
165 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// NSApp+Extensions.swift | ||
// HeliPort | ||
// | ||
// Created by Bat.bat on 29/7/2024. | ||
// Copyright © 2024 OpenIntelWireless. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
extension NSApplication { | ||
@available(macOS 10.15, *) | ||
func restartApp() { | ||
let config = NSWorkspace.OpenConfiguration() | ||
config.createsNewApplicationInstance = true | ||
|
||
NSWorkspace.shared.openApplication(at: Bundle.main.bundleURL, | ||
configuration: config, | ||
completionHandler: { _, error in | ||
if let error { | ||
Log.error("Failed to restart the app: \(error)") | ||
} else { | ||
DispatchQueue.main.async { | ||
NSApp.terminate(nil) | ||
} | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters