mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-13 19:15:48 +00:00
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:
committed by
Mitchell Hashimoto
parent
2ac3c1f1da
commit
b65261eb66
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user