move a bunch of files to src/os

This commit is contained in:
Mitchell Hashimoto
2023-07-10 16:48:22 -07:00
parent 9300404603
commit bf25bf0a6a
6 changed files with 8 additions and 11 deletions

View File

@ -4,10 +4,8 @@ const builtin = @import("builtin");
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator; const ArenaAllocator = std.heap.ArenaAllocator;
const inputpkg = @import("input.zig"); const inputpkg = @import("input.zig");
const passwd = @import("passwd.zig");
const terminal = @import("terminal/main.zig"); const terminal = @import("terminal/main.zig");
const internal_os = @import("os/main.zig"); const internal_os = @import("os/main.zig");
const xdg = @import("xdg.zig");
const cli_args = @import("cli_args.zig"); const cli_args = @import("cli_args.zig");
const log = std.log.scoped(.config); const log = std.log.scoped(.config);
@ -625,7 +623,7 @@ pub const Config = struct {
/// Load the configuration from the default file locations. Currently, /// Load the configuration from the default file locations. Currently,
/// this loads from $XDG_CONFIG_HOME/ghostty/config. /// this loads from $XDG_CONFIG_HOME/ghostty/config.
pub fn loadDefaultFiles(self: *Config, alloc: Allocator) !void { pub fn loadDefaultFiles(self: *Config, alloc: Allocator) !void {
const home_config_path = try xdg.config(alloc, .{ .subdir = "ghostty/config" }); const home_config_path = try internal_os.xdg.config(alloc, .{ .subdir = "ghostty/config" });
defer alloc.free(home_config_path); defer alloc.free(home_config_path);
const cwd = std.fs.cwd(); const cwd = std.fs.cwd();
@ -740,7 +738,7 @@ pub const Config = struct {
} }
// We need the passwd entry for the remainder // We need the passwd entry for the remainder
const pw = try passwd.get(alloc); const pw = try internal_os.passwd.get(alloc);
if (self.command == null) { if (self.command == null) {
if (pw.shell) |sh| { if (pw.shell) |sh| {
log.info("default shell src=passwd value={s}", .{sh}); log.info("default shell src=passwd value={s}", .{sh});

View File

@ -10,7 +10,6 @@ const xev = @import("xev");
const fontconfig = @import("fontconfig"); const fontconfig = @import("fontconfig");
const harfbuzz = @import("harfbuzz"); const harfbuzz = @import("harfbuzz");
const renderer = @import("renderer.zig"); const renderer = @import("renderer.zig");
const xdg = @import("xdg.zig");
const apprt = @import("apprt.zig"); const apprt = @import("apprt.zig");
const App = @import("App.zig"); const App = @import("App.zig");
@ -194,9 +193,6 @@ test {
// TODO // TODO
_ = @import("blocking_queue.zig"); _ = @import("blocking_queue.zig");
_ = @import("config.zig"); _ = @import("config.zig");
_ = @import("homedir.zig");
_ = @import("passwd.zig");
_ = @import("xdg.zig");
_ = @import("cli_args.zig"); _ = @import("cli_args.zig");
_ = @import("lru.zig"); _ = @import("lru.zig");
} }

View File

@ -3,7 +3,10 @@
pub usingnamespace @import("file.zig"); pub usingnamespace @import("file.zig");
pub usingnamespace @import("flatpak.zig"); pub usingnamespace @import("flatpak.zig");
pub usingnamespace @import("homedir.zig");
pub usingnamespace @import("locale.zig"); pub usingnamespace @import("locale.zig");
pub usingnamespace @import("macos_version.zig"); pub usingnamespace @import("macos_version.zig");
pub usingnamespace @import("mouse.zig"); pub usingnamespace @import("mouse.zig");
pub const TempDir = @import("TempDir.zig"); pub const TempDir = @import("TempDir.zig");
pub const passwd = @import("passwd.zig");
pub const xdg = @import("xdg.zig");

View File

@ -1,9 +1,9 @@
const std = @import("std"); const std = @import("std");
const builtin = @import("builtin"); const builtin = @import("builtin");
const build_config = @import("build_config.zig"); const internal_os = @import("main.zig");
const build_config = @import("../build_config.zig");
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator; const ArenaAllocator = std.heap.ArenaAllocator;
const internal_os = @import("os/main.zig");
const log = std.log.scoped(.passwd); const log = std.log.scoped(.passwd);
@ -61,7 +61,7 @@ pub fn get(alloc: Allocator) !Entry {
// Note: we wrap our getent call in a /bin/sh login shell because // Note: we wrap our getent call in a /bin/sh login shell because
// some operating systems (NixOS tested) don't set the PATH for various // some operating systems (NixOS tested) don't set the PATH for various
// utilities properly until we get a login shell. // utilities properly until we get a login shell.
const Pty = @import("Pty.zig"); const Pty = @import("../Pty.zig");
var pty = try Pty.open(.{}); var pty = try Pty.open(.{});
defer pty.deinit(); defer pty.deinit();
var cmd: internal_os.FlatpakHostCommand = .{ var cmd: internal_os.FlatpakHostCommand = .{