Skip to content

Commit

Permalink
Try to create parent directory when writing default config (#4295)
Browse files Browse the repository at this point in the history
Fixes #4277
  • Loading branch information
mitchellh authored Jan 1, 2025
2 parents 8998291 + cdf51b1 commit 9459910
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9459910

Please sign in to comment.