From 7e9be00924144950ab6100cb7136e91c6abb403e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 12 Mar 2025 10:13:31 -0700 Subject: [PATCH] working on macos --- build.zig.zon | 4 ++-- pkg/macos/build.zig | 2 +- pkg/macos/os/{log.c => zig_log.c} | 0 src/Command.zig | 2 +- src/input/KeymapDarwin.zig | 2 +- src/inspector/Inspector.zig | 2 +- src/inspector/page.zig | 2 +- src/os/file.zig | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename pkg/macos/os/{log.c => zig_log.c} (100%) diff --git a/build.zig.zon b/build.zig.zon index 3137d7b04..bad8fd6eb 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -29,8 +29,8 @@ }, .zig_objc = .{ // mitchellh/zig-objc - .url = "https://github.com/mitchellh/zig-objc/archive/2329503f692fd5c8ff4c0528b066a22c40dc58e8.tar.gz", - .hash = "zig_objc-0.0.0-Ir_Sp3TyAABFhwDzqDGShnFQmexkp4fHcSTafA9S_Lrh", + .url = "https://github.com/mitchellh/zig-objc/archive/3ab0d37c7d6b933d6ded1b3a35b6b60f05590a98.tar.gz", + .hash = "zig_objc-0.0.0-Ir_Sp3TyAADEVRTxXlScq3t_uKAM91MYNerZkHfbD0yt", }, .zig_js = .{ // mitchellh/zig-js diff --git a/pkg/macos/build.zig b/pkg/macos/build.zig index fa56ea662..fcc1a2226 100644 --- a/pkg/macos/build.zig +++ b/pkg/macos/build.zig @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void { var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); lib.addCSourceFile(.{ - .file = b.path("os/log.c"), + .file = b.path("os/zig_log.c"), .flags = flags.items, }); lib.addCSourceFile(.{ diff --git a/pkg/macos/os/log.c b/pkg/macos/os/zig_log.c similarity index 100% rename from pkg/macos/os/log.c rename to pkg/macos/os/zig_log.c diff --git a/src/Command.zig b/src/Command.zig index 6e30eae13..ffc44423f 100644 --- a/src/Command.zig +++ b/src/Command.zig @@ -392,7 +392,7 @@ pub fn expandPath(alloc: Allocator, cmd: []const u8) !?[]u8 { const PATH = switch (builtin.os.tag) { .windows => blk: { const win_path = std.process.getenvW(std.unicode.utf8ToUtf16LeStringLiteral("PATH")) orelse return null; - const path = try std.unicode.utf16leToUtf8Alloc(alloc, win_path); + const path = try std.unicode.utf16LeToUtf8Alloc(alloc, win_path); break :blk path; }, else => std.posix.getenvZ("PATH") orelse return null, diff --git a/src/input/KeymapDarwin.zig b/src/input/KeymapDarwin.zig index 154f648a6..53c305ab1 100644 --- a/src/input/KeymapDarwin.zig +++ b/src/input/KeymapDarwin.zig @@ -195,7 +195,7 @@ pub fn translate( } else false; // Convert the utf16 to utf8 - const len = try std.unicode.utf16leToUtf8(out, char[0..char_count]); + const len = try std.unicode.utf16LeToUtf8(out, char[0..char_count]); return .{ .text = out[0..len], .composing = composing, diff --git a/src/inspector/Inspector.zig b/src/inspector/Inspector.zig index 53a602abc..edc204886 100644 --- a/src/inspector/Inspector.zig +++ b/src/inspector/Inspector.zig @@ -390,7 +390,7 @@ fn renderScreenWindow(self: *Inspector) void { if (kitty_flags.int() != 0) { const Flags = @TypeOf(kitty_flags); - inline for (@typeInfo(Flags).Struct.fields) |field| { + inline for (@typeInfo(Flags).@"struct".fields) |field| { { const value = @field(kitty_flags, field.name); diff --git a/src/inspector/page.zig b/src/inspector/page.zig index bb95d59b9..0b8609d5a 100644 --- a/src/inspector/page.zig +++ b/src/inspector/page.zig @@ -28,7 +28,7 @@ pub fn render(page: *const terminal.Page) void { { _ = cimgui.c.igTableSetColumnIndex(1); cimgui.c.igText("%d bytes (%d KiB)", page.memory.len, units.toKibiBytes(page.memory.len)); - cimgui.c.igText("%d VM pages", page.memory.len / std.mem.page_size); + cimgui.c.igText("%d VM pages", page.memory.len / std.heap.page_size_min); } } { diff --git a/src/os/file.zig b/src/os/file.zig index 875dd2c25..0f25503a2 100644 --- a/src/os/file.zig +++ b/src/os/file.zig @@ -59,7 +59,7 @@ pub fn allocTmpDir(allocator: std.mem.Allocator) ?[]const u8 { if (builtin.os.tag == .windows) { // TODO: what is a good fallback path on windows? const v = std.process.getenvW(std.unicode.utf8ToUtf16LeStringLiteral("TMP")) orelse return null; - return std.unicode.utf16leToUtf8Alloc(allocator, v) catch |e| { + return std.unicode.utf16LeToUtf8Alloc(allocator, v) catch |e| { log.warn("failed to convert temp dir path from windows string: {}", .{e}); return null; };