From 305a978e2a5cac99dcfc847ec9dbc22572ab6e91 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Mon, 29 Jul 2024 21:57:22 +0800 Subject: [PATCH] Skip backup when not exist [GitHub #47] --- include/chsrc.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/chsrc.h b/include/chsrc.h index a21c005..e4b0f71 100644 --- a/include/chsrc.h +++ b/include/chsrc.h @@ -716,6 +716,13 @@ static void chsrc_backup (const char *path) { char *cmd = NULL; + bool exist = xy_file_exist (path); + + if (!exist) + { + chsrc_note_remarkably (xy_2strjoin ("文件不存在,跳过备份: ", path)); + return; + } if (xy_on_bsd || xy_on_macos) {