mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
reverse order of xdg system config files
This commit is contained in:
@ -2934,7 +2934,15 @@ pub fn loadDefaultFiles(self: *Config, alloc: Allocator) !void {
|
|||||||
const config_file = "config";
|
const config_file = "config";
|
||||||
// Load XDG system config first
|
// Load XDG system config first
|
||||||
var it = internal_os.xdg.DirIterator.init(.config);
|
var it = internal_os.xdg.DirIterator.init(.config);
|
||||||
while (it.next()) |xdg_dir| {
|
// We must reverse the order of the iterator because the first xdg config
|
||||||
|
// dir must takes importance per the spec https://specifications.freedesktop.org/basedir-spec/latest/#variables
|
||||||
|
var xdg_config_dirs = std.ArrayList([]const u8).init(alloc);
|
||||||
|
defer xdg_config_dirs.deinit();
|
||||||
|
while (it.next()) |d| {
|
||||||
|
try xdg_config_dirs.insert(0, d);
|
||||||
|
}
|
||||||
|
// Apply the system configs from last to first
|
||||||
|
for (xdg_config_dirs.items) |xdg_dir| {
|
||||||
const config_path = try std.fs.path.join(alloc, &[_][]const u8{
|
const config_path = try std.fs.path.join(alloc, &[_][]const u8{
|
||||||
xdg_dir,
|
xdg_dir,
|
||||||
config_subdir,
|
config_subdir,
|
||||||
|
Reference in New Issue
Block a user