From fbd2c344875b5f77dde0a50bf890854ecc55ec97 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Nov 2023 15:48:43 -0800 Subject: [PATCH] os: more comments --- src/os/resourcesdir.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/os/resourcesdir.zig b/src/os/resourcesdir.zig index 940321469..9726b6cdf 100644 --- a/src/os/resourcesdir.zig +++ b/src/os/resourcesdir.zig @@ -10,6 +10,8 @@ const Allocator = std.mem.Allocator; /// some point but we can cross that bridge if we ever need to. pub fn resourcesDir(alloc: std.mem.Allocator) !?[]const u8 { // If we have an environment variable set, we always use that. + // Note: we ALWAYS want to allocate here because the result is always + // freed, do not try to use internal_os.getenv or posix getenv. if (std.process.getEnvVarOwned(alloc, "GHOSTTY_RESOURCES_DIR")) |dir| { if (dir.len > 0) return dir; } else |err| switch (err) {