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" });
|
||||
|
||||
if (comptime builtin.os.tag == .macos) macos: {
|
||||
// On macOS, use the application support path if the XDG path doesn't exists.
|
||||
if (std.fs.accessAbsolute(xdg_config_path, .{})) {
|
||||
break :macos;
|
||||
// On macOS, use the XDG path if the app support path doesn't exist.
|
||||
const app_support_path = try internal_os.macos.appSupportDir(alloc_gpa, "config");
|
||||
if (std.fs.accessAbsolute(app_support_path, .{})) {
|
||||
alloc_gpa.free(xdg_config_path);
|
||||
break :config_path app_support_path;
|
||||
} else |err| switch (err) {
|
||||
error.BadPathName, error.FileNotFound => {},
|
||||
else => break :macos,
|
||||
}
|
||||
|
||||
alloc_gpa.free(xdg_config_path);
|
||||
break :config_path try internal_os.macos.appSupportDir(alloc_gpa, "config");
|
||||
if (std.fs.accessAbsolute(xdg_config_path, .{})) {
|
||||
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;
|
||||
|
Reference in New Issue
Block a user