mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
config: enable passwd isn't compiled for wasm
This commit is contained in:
@ -26,6 +26,10 @@ fetch(url.href).then(response =>
|
||||
const {
|
||||
malloc,
|
||||
free,
|
||||
config_new,
|
||||
config_free,
|
||||
config_load_string,
|
||||
config_finalize,
|
||||
face_new,
|
||||
face_free,
|
||||
face_render_glyph,
|
||||
@ -68,6 +72,12 @@ fetch(url.href).then(response =>
|
||||
return { ptr: ptr, len: utf8.byteLength };
|
||||
};
|
||||
|
||||
// Create our config
|
||||
const config = config_new();
|
||||
const config_str = makeStr("font-family = monospace");
|
||||
config_load_string(config, config_str.ptr, config_str.len);
|
||||
config_finalize(config);
|
||||
|
||||
// Create our atlas
|
||||
// const atlas = atlas_new(512, 0 /* greyscale */);
|
||||
|
||||
|
@ -314,33 +314,36 @@ pub const Config = struct {
|
||||
};
|
||||
|
||||
// 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. We only do this
|
||||
// on desktop.
|
||||
const wd_home = std.mem.eql(u8, "home", wd);
|
||||
if (self.command == null or wd_home) command: {
|
||||
const alloc = self._arena.?.allocator();
|
||||
if (comptime !builtin.target.isWasm()) {
|
||||
if (self.command == null or wd_home) command: {
|
||||
const alloc = self._arena.?.allocator();
|
||||
|
||||
// First look up the command using the SHELL env var.
|
||||
if (std.process.getEnvVarOwned(alloc, "SHELL")) |value| {
|
||||
log.debug("default shell source=env value={s}", .{value});
|
||||
self.command = value;
|
||||
// First look up the command using the SHELL env var.
|
||||
if (std.process.getEnvVarOwned(alloc, "SHELL")) |value| {
|
||||
log.debug("default shell source=env value={s}", .{value});
|
||||
self.command = value;
|
||||
|
||||
// If we don't need the working directory, then we can exit now.
|
||||
if (!wd_home) break :command;
|
||||
} else |_| {}
|
||||
// If we don't need the working directory, then we can exit now.
|
||||
if (!wd_home) break :command;
|
||||
} else |_| {}
|
||||
|
||||
// We need the passwd entry for the remainder
|
||||
const pw = try passwd.get(alloc);
|
||||
if (self.command == null) {
|
||||
if (pw.shell) |sh| {
|
||||
log.debug("default shell src=passwd value={s}", .{sh});
|
||||
self.command = sh;
|
||||
// We need the passwd entry for the remainder
|
||||
const pw = try passwd.get(alloc);
|
||||
if (self.command == null) {
|
||||
if (pw.shell) |sh| {
|
||||
log.debug("default shell src=passwd value={s}", .{sh});
|
||||
self.command = sh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wd_home) {
|
||||
if (pw.home) |home| {
|
||||
log.debug("default working directory src=passwd value={s}", .{home});
|
||||
self.@"working-directory" = home;
|
||||
if (wd_home) {
|
||||
if (pw.home) |home| {
|
||||
log.debug("default working directory src=passwd value={s}", .{home});
|
||||
self.@"working-directory" = home;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -528,7 +531,7 @@ pub const Keybinds = struct {
|
||||
};
|
||||
|
||||
// Wasm API.
|
||||
pub const Wasm = struct {
|
||||
pub const Wasm = if (!builtin.target.isWasm()) struct {} else struct {
|
||||
const wasm = @import("os/wasm.zig");
|
||||
const alloc = wasm.alloc;
|
||||
const cli_args = @import("cli_args.zig");
|
||||
|
@ -5,6 +5,13 @@ const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
|
||||
const log = std.log.scoped(.passwd);
|
||||
|
||||
// We want to be extra sure since this will force bad symbols into our import table
|
||||
comptime {
|
||||
if (builtin.target.isWasm()) {
|
||||
@compileError("passwd is not available for wasm");
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to determine the default shell and directory on Unixes.
|
||||
const c = @cImport({
|
||||
@cInclude("sys/types.h");
|
||||
|
Reference in New Issue
Block a user