Menu: add more debug utilities

This commit is contained in:
Peter Steinberger
2025-12-09 21:06:21 +01:00
parent 5e5845547e
commit 1a0e57d926
3 changed files with 100 additions and 33 deletions

View File

@@ -194,7 +194,7 @@ struct DebugSettings: View {
}
}
HStack {
Button("Restart app") { self.relaunch() }
Button("Restart app") { DebugActions.restartApp() }
Button("Reveal app in Finder") { self.revealApp() }
Button("Restart Gateway") { DebugActions.restartGateway() }
Button("Clear log") { GatewayProcessManager.shared.clearLog() }
@@ -266,19 +266,6 @@ struct DebugSettings: View {
}
}
private func relaunch() {
let url = Bundle.main.bundleURL
let task = Process()
task.launchPath = "/bin/sh"
task.arguments = ["-c", "sleep 0.3; open -n \"\(url.path)\""]
task.standardOutput = nil
task.standardError = nil
task.standardInput = nil
try? task.run()
// Terminate current instance; spawned shell re-opens after a short delay.
NSApp.terminate(nil)
}
private func revealApp() {
let url = Bundle.main.bundleURL
NSWorkspace.shared.activateFileViewerSelecting([url])