mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
added conditional to edit.open so that when a config file exists in the app support directory on osx, it will prioritise opening that one over the one in the xdg config folder.
This commit is contained in:
@ -11,16 +11,23 @@ pub fn open(alloc_gpa: Allocator) !void {
|
|||||||
const xdg_config_path = try internal_os.xdg.config(alloc_gpa, .{ .subdir = "ghostty/config" });
|
const xdg_config_path = try internal_os.xdg.config(alloc_gpa, .{ .subdir = "ghostty/config" });
|
||||||
|
|
||||||
if (comptime builtin.os.tag == .macos) macos: {
|
if (comptime builtin.os.tag == .macos) macos: {
|
||||||
// On macOS, use the application support path if the XDG path doesn't exists.
|
// On macOS, use the XDG path if the app support path doesn't exist.
|
||||||
if (std.fs.accessAbsolute(xdg_config_path, .{})) {
|
const app_support_path = try internal_os.macos.appSupportDir(alloc_gpa, "config");
|
||||||
break :macos;
|
if (std.fs.accessAbsolute(app_support_path, .{})) {
|
||||||
|
alloc_gpa.free(xdg_config_path);
|
||||||
|
break :config_path app_support_path;
|
||||||
} else |err| switch (err) {
|
} else |err| switch (err) {
|
||||||
error.BadPathName, error.FileNotFound => {},
|
error.BadPathName, error.FileNotFound => {},
|
||||||
else => break :macos,
|
else => break :macos,
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc_gpa.free(xdg_config_path);
|
if (std.fs.accessAbsolute(xdg_config_path, .{})) {
|
||||||
break :config_path try internal_os.macos.appSupportDir(alloc_gpa, "config");
|
alloc_gpa.free(app_support_path);
|
||||||
|
break :macos;
|
||||||
|
} else |err| switch (err) {
|
||||||
|
error.BadPathName, error.FileNotFound => {},
|
||||||
|
else => break :macos,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break :config_path xdg_config_path;
|
break :config_path xdg_config_path;
|
||||||
|
Reference in New Issue
Block a user