macos: open URLs with NSWorkspace APIs instead of open

Fixes #5256

This updates the macOS apprt to implement the `OPEN_URL` apprt action to
use the NSWorkspace APIs instead of the `open` command line utility.

As part of this, we removed the `ghostty_config_open` libghostty API and
instead introduced a new `ghostty_config_open_path` API that returns the
path to open, and then we use the `NSWorkspace` APIs to open it (same
function as the `OPEN_URL` action).
This commit is contained in:
Mitchell Hashimoto
2025-07-06 20:23:20 -07:00
parent db45fab85e
commit b7ffbf933f
11 changed files with 212 additions and 29 deletions

View File

@@ -73,6 +73,26 @@ extension Ghostty {
// MARK: Swift Types for C Types
extension Ghostty {
class AllocatedString {
private let cString: ghostty_string_s
init(_ c: ghostty_string_s) {
self.cString = c
}
var string: String {
guard let ptr = cString.ptr else { return "" }
let data = Data(bytes: ptr, count: Int(cString.len))
return String(data: data, encoding: .utf8) ?? ""
}
deinit {
ghostty_string_free(cString)
}
}
}
extension Ghostty {
enum SetFloatWIndow {
case on