fix: 修复文件路径检查日志,确保输出绝对路径
This commit is contained in:
16
list.yaml
16
list.yaml
@@ -1,19 +1,19 @@
|
||||
# 需要自动更新的文件列表
|
||||
# Docker
|
||||
- file: /docker/install/install.sh
|
||||
- file: docker/install/install.sh
|
||||
source: https://raw.githubusercontent.com/docker/docker-install/master/install.sh
|
||||
- file: /docker/install/debian/gpg
|
||||
- file: docker/install/debian/gpg
|
||||
source: https://download.docker.com/linux/debian/gpg
|
||||
- file: /docker/install/ubuntu/gpg
|
||||
- file: docker/install/ubuntu/gpg
|
||||
source: https://download.docker.com/linux/ubuntu/gpg
|
||||
- file: /docker/install/raspbian/gpg
|
||||
- file: docker/install/raspbian/gpg
|
||||
source: https://download.docker.com/linux/raspbian/gpg
|
||||
- file: /docker/install/fedora/docker-ce.repo
|
||||
- file: docker/install/fedora/docker-ce.repo
|
||||
source: https://download.docker.com/linux/fedora/docker-ce.repo
|
||||
- file: /docker/install/centos/docker-ce.repo
|
||||
- file: docker/install/centos/docker-ce.repo
|
||||
source: https://download.docker.com/linux/centos/docker-ce.repo
|
||||
# AdGuard
|
||||
- file: /adguard/filter_1.txt
|
||||
- file: adguard/filter_1.txt
|
||||
source: https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt
|
||||
- file: /adguard/217heidai.txt
|
||||
- file: adguard/217heidai.txt
|
||||
source: https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/adblockdns.txt
|
||||
@@ -49,14 +49,13 @@ def process_item(item):
|
||||
os.makedirs(os.path.dirname(abs_file_path), exist_ok=True)
|
||||
|
||||
updated = False
|
||||
logging.info(f"📝 检查 {abs_file_path} 是否需要更新")
|
||||
if os.path.exists(abs_file_path):
|
||||
with open(abs_file_path, "r", encoding="utf-8") as f:
|
||||
old_content = f.read()
|
||||
if old_content != new_content:
|
||||
updated = True
|
||||
else:
|
||||
logging.warning(f"⚠️ 文件 {file_path} 不存在,将创建。")
|
||||
logging.warning(f"⚠️ 文件 {abs_file_path} 不存在,将创建。")
|
||||
updated = True
|
||||
|
||||
if updated:
|
||||
|
||||
Reference in New Issue
Block a user