mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 17:26:09 +03:00
properly handle "inherit" working directory value
This commit is contained in:
@ -174,14 +174,14 @@ pub const Config = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The default for the working directory depends on the system.
|
// The default for the working directory depends on the system.
|
||||||
const wd_default = switch (builtin.os.tag) {
|
const wd = self.@"working-directory" orelse switch (builtin.os.tag) {
|
||||||
.macos => if (c.getppid() == 1) "home" else "inherit",
|
.macos => if (c.getppid() == 1) "home" else "inherit",
|
||||||
else => "inherit",
|
else => "inherit",
|
||||||
};
|
};
|
||||||
|
|
||||||
// If we are missing either a command or home directory, we need
|
// If we are missing either a command or home directory, we need
|
||||||
// to look up defaults which is kind of expensive.
|
// to look up defaults which is kind of expensive.
|
||||||
const wd_home = std.mem.eql(u8, "home", self.@"working-directory" orelse wd_default);
|
const wd_home = std.mem.eql(u8, "home", wd);
|
||||||
if (self.command == null or wd_home) command: {
|
if (self.command == null or wd_home) command: {
|
||||||
const alloc = self._arena.?.allocator();
|
const alloc = self._arena.?.allocator();
|
||||||
|
|
||||||
@ -210,6 +210,10 @@ pub const Config = struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have the special value "inherit" then set it to null which
|
||||||
|
// does the same. In the future we should change to a tagged union.
|
||||||
|
if (std.mem.eql(u8, wd, "inherit")) self.@"working-directory" = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user