From 8cfb3be4cd36689d39eafb1ae1c5cf0b067b31f4 Mon Sep 17 00:00:00 2001 From: Perdixky <3293789706@qq.com> Date: Thu, 4 Dec 2025 17:06:26 +0800 Subject: [PATCH] Use a public API to wrap rsync_* function --- sdata/subcmd-install/3.files-legacy.sh | 6 +----- sdata/subcmd-install/3.files.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sdata/subcmd-install/3.files-legacy.sh b/sdata/subcmd-install/3.files-legacy.sh index 98d792be8..0a3bef85f 100644 --- a/sdata/subcmd-install/3.files-legacy.sh +++ b/sdata/subcmd-install/3.files-legacy.sh @@ -30,11 +30,7 @@ esac case "${SKIP_FISH}" in true) sleep 0;; *) - # Use rsync with exclude to preserve user's custom conf.d directory - if [ -d "$XDG_CONFIG_HOME"/fish ];then - warning_overwrite - fi - rsync_dir__sync_exclude dots/.config/fish "$XDG_CONFIG_HOME"/fish "conf.d" + install_dir__sync_exclude dots/.config/fish "$XDG_CONFIG_HOME"/fish "conf.d" ;; esac diff --git a/sdata/subcmd-install/3.files.sh b/sdata/subcmd-install/3.files.sh index 2bd2e1190..aa3099ab0 100644 --- a/sdata/subcmd-install/3.files.sh +++ b/sdata/subcmd-install/3.files.sh @@ -137,6 +137,18 @@ function install_dir__skip_existed(){ v rsync_dir $s $t fi } +function install_dir__sync_exclude(){ + # NOTE: Do not add prefix `v` or `x` when using this function + # Sync directory with exclude patterns + # Usage: install_dir__sync_exclude [ ...] + local s=$1 + local t=$2 + shift 2 + if [ -d $t ];then + warning_overwrite + fi + rsync_dir__sync_exclude $s $t "$@" +} function install_google_sans_flex(){ local font_name="Google Sans Flex" local src_name="google-sans-flex"