Mac: debug log button shows path and opens in Finder

This commit is contained in:
Peter Steinberger
2025-12-07 03:29:58 +00:00
parent 36ba1ff790
commit 33396ca9c1

View File

@@ -17,6 +17,10 @@ struct DebugSettings: View {
LabeledContent("Log file") { LabeledContent("Log file") {
Button("Open pino log") { self.openLog() } Button("Open pino log") { self.openLog() }
.help(self.pinoLogPath) .help(self.pinoLogPath)
Text(self.pinoLogPath)
.font(.caption2.monospaced())
.foregroundStyle(.secondary)
.textSelection(.enabled)
} }
LabeledContent("Binary path") { Text(Bundle.main.bundlePath).font(.footnote) } LabeledContent("Binary path") { Text(Bundle.main.bundlePath).font(.footnote) }
LabeledContent("Relay status") { LabeledContent("Relay status") {
@@ -126,8 +130,16 @@ struct DebugSettings: View {
} }
private func openLog() { private func openLog() {
let url = URL(fileURLWithPath: self.pinoLogPath) let path = self.pinoLogPath
NSWorkspace.shared.open(url) let url = URL(fileURLWithPath: path)
if !FileManager.default.fileExists(atPath: path) {
let alert = NSAlert()
alert.messageText = "Log file not found"
alert.informativeText = path
alert.runModal()
return
}
NSWorkspace.shared.activateFileViewerSelecting([url])
} }
private func chooseCatalogFile() { private func chooseCatalogFile() {