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

Fixes https://github.com/ghostty-org/ghostty/issues/4277
pull/4341/head
Mitchell Hashimoto 2025-01-01 13:02:08 -08:00 committed by GitHub
commit 94599102e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -2695,6 +2695,9 @@ pub fn loadOptionalFile(
fn writeConfigTemplate(path: []const u8) !void {
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, .{});
defer file.close();
try std.fmt.format(