refactor: Fix macOS standalone application
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#if os(macOS)
|
||||
import Foundation
|
||||
import ServiceManagement
|
||||
|
||||
public enum HelperServiceManager {
|
||||
private static var rootHelperService: SMAppService {
|
||||
SMAppService.daemon(plistName: "\(AppConfiguration.rootHelperBundleID).plist")
|
||||
}
|
||||
|
||||
public static var rootHelperStatus: SMAppService.Status {
|
||||
rootHelperService.status
|
||||
}
|
||||
|
||||
public static func registerRootHelper() throws {
|
||||
if rootHelperService.status == .enabled {
|
||||
try rootHelperService.unregister()
|
||||
}
|
||||
try rootHelperService.register()
|
||||
}
|
||||
|
||||
public static func unregisterRootHelper() throws {
|
||||
try rootHelperService.unregister()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user