macOS: expand tilde in file paths before opening

`URL(filePath:)` treats `~` as a literal directory name, so
cmd-clicking a path like `~/Documents/file.txt` would fail to
open because the resulting file URL doesn't point to a real file.

Use `NSString.expandingTildeInPath` to resolve `~` to the user's
home directory before constructing the file URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Feijoo
2026-02-19 11:39:12 -05:00
committed by Mitchell Hashimoto
parent 2ac3c1f1da
commit b65261eb66

View File

@@ -695,7 +695,10 @@ extension Ghostty {
if let candidate = URL(string: action.url), candidate.scheme != nil {
url = candidate
} else {
url = URL(filePath: action.url)
// Expand ~ to the user's home directory so that file paths
// like ~/Documents/file.txt resolve correctly.
let expandedPath = NSString(string: action.url).standardizingPath
url = URL(filePath: expandedPath)
}
switch action.kind {