Skip to content

Commit e5cde68

Browse files
committed
fix(application): save twice if auto_save and -o option
1 parent 061155c commit e5cde68

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/application.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,14 @@ static void save_state_to_file_or_folder(struct swappy_state *state,
304304
}
305305
}
306306

307+
// We might need to save twice, once for auto_save config
308+
// and one for the output_file from -o CLI option.
307309
static void maybe_save_output_file(struct swappy_state *state) {
308-
if (state->config->auto_save || state->output_file) {
310+
if (state->config->auto_save) {
311+
save_state_to_file_or_folder(state, NULL);
312+
}
313+
314+
if (state->output_file) {
309315
save_state_to_file_or_folder(state, state->output_file);
310316
}
311317
}

0 commit comments

Comments
 (0)