mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
shuffle some code
This commit is contained in:
@ -1134,38 +1134,42 @@ pub fn finalize(self: *Config) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builtin.target.os.tag == .windows) {
|
switch (builtin.os.tag) {
|
||||||
if (self.command == null) {
|
.windows => {
|
||||||
log.warn("no default shell found, will default to using cmd", .{});
|
if (self.command == null) {
|
||||||
self.command = "cmd.exe";
|
log.warn("no default shell found, will default to using cmd", .{});
|
||||||
}
|
self.command = "cmd.exe";
|
||||||
|
|
||||||
if (wd_home) {
|
|
||||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
|
||||||
if (try internal_os.home(&buf)) |home| {
|
|
||||||
self.@"working-directory" = try alloc.dupe(u8, home);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// We need the passwd entry for the remainder
|
|
||||||
const pw = try internal_os.passwd.get(alloc);
|
|
||||||
if (self.command == null) {
|
|
||||||
if (pw.shell) |sh| {
|
|
||||||
log.info("default shell src=passwd value={s}", .{sh});
|
|
||||||
self.command = sh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wd_home) {
|
if (wd_home) {
|
||||||
if (pw.home) |home| {
|
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||||
log.info("default working directory src=passwd value={s}", .{home});
|
if (try internal_os.home(&buf)) |home| {
|
||||||
self.@"working-directory" = home;
|
self.@"working-directory" = try alloc.dupe(u8, home);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
if (self.command == null) {
|
else => {
|
||||||
log.warn("no default shell found, will default to using sh", .{});
|
// We need the passwd entry for the remainder
|
||||||
}
|
const pw = try internal_os.passwd.get(alloc);
|
||||||
|
if (self.command == null) {
|
||||||
|
if (pw.shell) |sh| {
|
||||||
|
log.info("default shell src=passwd value={s}", .{sh});
|
||||||
|
self.command = sh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wd_home) {
|
||||||
|
if (pw.home) |home| {
|
||||||
|
log.info("default working directory src=passwd value={s}", .{home});
|
||||||
|
self.@"working-directory" = home;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.command == null) {
|
||||||
|
log.warn("no default shell found, will default to using sh", .{});
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ fn homeWindows(buf: []u8) !?[]u8 {
|
|||||||
if (homepath.ptr != path_buf.ptr) @panic("codebug");
|
if (homepath.ptr != path_buf.ptr) @panic("codebug");
|
||||||
break :blk homepath.len;
|
break :blk homepath.len;
|
||||||
};
|
};
|
||||||
|
|
||||||
return buf[0 .. drive_len + path_len];
|
return buf[0 .. drive_len + path_len];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user