From b65261eb6643ace961e5ea548c329b3cbd646c40 Mon Sep 17 00:00:00 2001 From: Alex Feijoo Date: Thu, 19 Feb 2026 11:39:12 -0500 Subject: [PATCH] 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 --- macos/Sources/Ghostty/Ghostty.App.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/macos/Sources/Ghostty/Ghostty.App.swift b/macos/Sources/Ghostty/Ghostty.App.swift index e3441257f..6fb5118e8 100644 --- a/macos/Sources/Ghostty/Ghostty.App.swift +++ b/macos/Sources/Ghostty/Ghostty.App.swift @@ -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 {