Try to create parent directory when writing default config (#4295)

Fixes https://github.com/ghostty-org/ghostty/issues/4277
This commit is contained in:
Mitchell Hashimoto
2025-01-01 13:02:08 -08:00
committed by GitHub

View File

@ -2695,6 +2695,9 @@ pub fn loadOptionalFile(
fn writeConfigTemplate(path: []const u8) !void { fn writeConfigTemplate(path: []const u8) !void {
log.info("creating template config file: path={s}", .{path}); log.info("creating template config file: path={s}", .{path});
if (std.fs.path.dirname(path)) |dir_path| {
try std.fs.makeDirAbsolute(dir_path);
}
const file = try std.fs.createFileAbsolute(path, .{}); const file = try std.fs.createFileAbsolute(path, .{});
defer file.close(); defer file.close();
try std.fmt.format( try std.fmt.format(