Mac: debug log button shows path and opens in Finder
parent
36ba1ff790
commit
33396ca9c1
|
|
@ -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() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue