os: more comments

This commit is contained in:
Mitchell Hashimoto
2023-11-05 15:48:43 -08:00
parent b39d1d6095
commit fbd2c34487

View File

@ -10,6 +10,8 @@ const Allocator = std.mem.Allocator;
/// some point but we can cross that bridge if we ever need to. /// some point but we can cross that bridge if we ever need to.
pub fn resourcesDir(alloc: std.mem.Allocator) !?[]const u8 { pub fn resourcesDir(alloc: std.mem.Allocator) !?[]const u8 {
// If we have an environment variable set, we always use that. // 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 (std.process.getEnvVarOwned(alloc, "GHOSTTY_RESOURCES_DIR")) |dir| {
if (dir.len > 0) return dir; if (dir.len > 0) return dir;
} else |err| switch (err) { } else |err| switch (err) {