采集卡bug修复

This commit is contained in:
Ray
2025-10-29 15:27:50 +08:00
parent f7dbf223cb
commit bcc971d528
3 changed files with 236 additions and 52 deletions

View File

@@ -48,11 +48,20 @@ class ConfigManager:
def save_config(self):
"""保存配置文件"""
try:
import os
# 确保目录存在
config_dir = os.path.dirname(os.path.abspath(self.config_file))
if config_dir and not os.path.exists(config_dir):
os.makedirs(config_dir, exist_ok=True)
with open(self.config_file, 'w', encoding='utf-8') as f:
json.dump(self.config, f, ensure_ascii=False, indent=4)
print(f"✅ 配置文件已保存到: {os.path.abspath(self.config_file)}")
return True
except Exception as e:
print(f"保存配置文件失败: {e}")
print(f"保存配置文件失败: {e}")
import traceback
traceback.print_exc()
return False
def add_group(self, name=None):