Skip to content

Commit

Permalink
feat(config): try to create save_dir if it does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Gaoyang Zhang <[email protected]>
  • Loading branch information
blurgyy authored and jtheoof committed Apr 3, 2022
1 parent e3bd499 commit 4fb291a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ static void load_config_from_file(struct swappy_config *config,
save_dir_expanded = g_strdup(p.we_wordv[0]);
wordfree(&p);
if (!save_dir_expanded || !folder_exists(save_dir_expanded)) {
g_warning("save_dir: %s is not a valid directory", save_dir_expanded);
g_info("save_dir: attempting to create non-existent directory '%s'",
save_dir_expanded);
if (g_mkdir_with_parents(save_dir_expanded, 0755)) {
g_warning("save_dir: failed to create '%s'", save_dir_expanded);
}
}

g_free(save_dir);
Expand Down

0 comments on commit 4fb291a

Please sign in to comment.