mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 03:25:50 +00:00
## Summary Cmd-clicking a file path containing `~` (e.g. `~/Documents/file.txt`) fails to open the file on macOS because `URL(filePath:)` treats `~` as a literal directory name rather than the user's home directory. This uses `NSString.expandingTildeInPath` to resolve `~` before constructing the file URL. ## Root Cause In `openURL()`, when the URL string has no scheme it falls through to: ```swift url = URL(filePath: action.url) ``` Swift's `URL(filePath:)` does not perform tilde expansion. A path like `~/Documents/file.txt` produces a URL pointing to a non-existent file, and `NSWorkspace.open` silently fails. ## Fix ```swift let expandedPath = NSString(string: action.url).expandingTildeInPath url = URL(filePath: expandedPath) ``` ## Reproduction 1. Have a terminal application (e.g. Claude Code) that outputs file paths with `~` prefixes 2. Cmd-click the path in Ghostty on macOS 3. The file does not open (fails silently) With this fix, the path resolves correctly and opens in the default editor.