mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-28 19:46:35 +00:00
@@ -56,6 +56,9 @@ pub fn launchedFromDesktop() bool {
|
||||
// iPhone/iPad is always launched from the "desktop"
|
||||
.ios => true,
|
||||
|
||||
// Assume we are launching from the "desktop"
|
||||
.freebsd => true,
|
||||
|
||||
else => @compileError("unsupported platform"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ const Error = error{
|
||||
/// is generally an expensive process so the value should be cached.
|
||||
pub inline fn home(buf: []u8) !?[]const u8 {
|
||||
return switch (builtin.os.tag) {
|
||||
inline .linux, .macos => try homeUnix(buf),
|
||||
inline .linux, .freebsd, .macos => try homeUnix(buf),
|
||||
.windows => try homeWindows(buf),
|
||||
|
||||
// iOS doesn't have a user-writable home directory
|
||||
@@ -122,7 +122,7 @@ pub const ExpandError = error{
|
||||
/// than `buf.len`.
|
||||
pub fn expandHome(path: []const u8, buf: []u8) ExpandError![]const u8 {
|
||||
return switch (builtin.os.tag) {
|
||||
.linux, .macos => try expandHomeUnix(path, buf),
|
||||
.linux, .freebsd, .macos => try expandHomeUnix(path, buf),
|
||||
.ios => return path,
|
||||
else => @compileError("unimplemented"),
|
||||
};
|
||||
|
||||
@@ -69,22 +69,24 @@ pub const InitError = error{
|
||||
/// used by libghostty.
|
||||
pub fn init(resources_dir: []const u8) InitError!void {
|
||||
// i18n is unsupported on Windows
|
||||
if (builtin.os.tag == .windows) return;
|
||||
switch (builtin.os.tag) {
|
||||
.windows, .freebsd => return,
|
||||
else => {
|
||||
// Our resources dir is always nested below the share dir that
|
||||
// is standard for translations.
|
||||
const share_dir = std.fs.path.dirname(resources_dir) orelse
|
||||
return error.InvalidResourcesDir;
|
||||
|
||||
// Our resources dir is always nested below the share dir that
|
||||
// is standard for translations.
|
||||
const share_dir = std.fs.path.dirname(resources_dir) orelse
|
||||
return error.InvalidResourcesDir;
|
||||
// Build our locale path
|
||||
var buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
const path = std.fmt.bufPrintZ(&buf, "{s}/locale", .{share_dir}) catch
|
||||
return error.OutOfMemory;
|
||||
|
||||
// Build our locale path
|
||||
var buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
const path = std.fmt.bufPrintZ(&buf, "{s}/locale", .{share_dir}) catch
|
||||
return error.OutOfMemory;
|
||||
|
||||
// Bind our bundle ID to the given locale path
|
||||
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
||||
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
||||
return error.OutOfMemory;
|
||||
// Bind our bundle ID to the given locale path
|
||||
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
||||
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
||||
return error.OutOfMemory;
|
||||
}}
|
||||
}
|
||||
|
||||
/// Set the global gettext domain to our bundle ID, allowing unqualified
|
||||
|
||||
@@ -19,7 +19,7 @@ pub fn open(
|
||||
url: []const u8,
|
||||
) !void {
|
||||
const cmd: OpenCommand = switch (builtin.os.tag) {
|
||||
.linux => .{ .child = std.process.Child.init(
|
||||
.linux, .freebsd => .{ .child = std.process.Child.init(
|
||||
&.{ "xdg-open", url },
|
||||
alloc,
|
||||
) },
|
||||
|
||||
Reference in New Issue
Block a user