termio: respect GHOSTTY_RESOURCES_DIR

This commit is contained in:
Mitchell Hashimoto
2023-08-05 21:38:32 -07:00
parent 2840062ad5
commit 321be2d5ad

View File

@ -533,10 +533,18 @@ const Subprocess = struct {
// Get our bundled resources directory, if it exists. We use this // Get our bundled resources directory, if it exists. We use this
// for terminfo, shell-integration, etc. // for terminfo, shell-integration, etc.
const resources_dir = try resourcesDir(alloc); const resources_key = "GHOSTTY_RESOURCES_DIR";
if (resources_dir) |dir| { const resources_dir = if (env.get(resources_key)) |dir| dir: {
try env.put("GHOSTTY_RESOURCES_DIR", dir); log.info("using Ghostty resources dir from env var: {s}", .{dir});
} break :dir dir;
} else if (try resourcesDir(alloc)) |dir| dir: {
log.info("found Ghostty resources dir: {s}", .{dir});
try env.put(resources_key, dir);
break :dir dir;
} else dir: {
log.warn("Ghostty resources dir not found, some features disabled", .{});
break :dir null;
};
// Set our TERM var. This is a bit complicated because we want to use // Set our TERM var. This is a bit complicated because we want to use
// the ghostty TERM value but we want to only do that if we have // the ghostty TERM value but we want to only do that if we have