summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wennberg <daniel.wennberg@gmail.com>2025-10-04 00:04:19 -0700
committerDaniel Wennberg <daniel.wennberg@gmail.com>2025-10-04 00:13:23 -0700
commit0b14026696e0bf54d5dba8940d8ae97201ddab27 (patch)
treed2f749e80a04f1afcadd33e9da7870517b1cc6e0
parent42a38ff672fe0cbbb8588380058c91ac16ed9069 (diff)
Expand `~` in `macos-custom-icon`
-rw-r--r--macos/Sources/Ghostty/Ghostty.Config.swift9
1 files changed, 3 insertions, 6 deletions
diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift
index 05a3be2cd..0d75922cb 100644
--- a/macos/Sources/Ghostty/Ghostty.Config.swift
+++ b/macos/Sources/Ghostty/Ghostty.Config.swift
@@ -314,17 +314,14 @@ extension Ghostty {
var macosCustomIcon: String {
#if os(macOS)
- let homeDirURL = FileManager.default.homeDirectoryForCurrentUser
- let ghosttyConfigIconPath = homeDirURL.appendingPathComponent(
- ".config/ghostty/Ghostty.icns",
- conformingTo: .fileURL).path()
- let defaultValue = ghosttyConfigIconPath
+ let defaultValue = NSString("~/.config/ghostty/Ghostty.icns").expandingTildeInPath
guard let config = self.config else { return defaultValue }
var v: UnsafePointer<Int8>? = nil
let key = "macos-custom-icon"
guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue }
guard let ptr = v else { return defaultValue }
- return String(cString: ptr)
+ guard let path = NSString(utf8String: ptr) else { return defaultValue }
+ return path.expandingTildeInPath
#else
return ""
#endif