aerospace fork
Something went wrong. Try again.
1234567891011121314151617import Foundation
// todo refactor. showMessageInGui in common code looks weirdfunc showMessageInGui(filenameIfConsoleApp: String, title: String, message: String) { let titleAndMessage = "##### \(title) #####\n\n" + message if isCli { print(titleAndMessage) } else { let cachesDir = URL(filePath: "/tmp/nagasrinath.deewm/") Result { try FileManager.default.createDirectory(at: cachesDir, withIntermediateDirectories: true) }.getOrDie() let file = cachesDir.appending(component: filenameIfConsoleApp) Result { try (titleAndMessage + "\n").write(to: file, atomically: true, encoding: .utf8) }.getOrDie()
file.absoluteURL.open(with: URL(filePath: "/System/Applications/Utilities/Console.app")) }}