From 00f17c417b3fcdef619f9d502c0403e2db913bcd Mon Sep 17 00:00:00 2001 From: Madray Haven Date: Wed, 5 Feb 2025 20:06:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20move=20old=20config=20file=20in?= =?UTF-8?q?=20docker=20(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsuid_core/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gsuid_core/config.py b/gsuid_core/config.py index 77b1857..d7da6d6 100644 --- a/gsuid_core/config.py +++ b/gsuid_core/config.py @@ -1,4 +1,5 @@ import json +import shutil from pathlib import Path from typing import Any, Dict, List, Union, Literal, overload @@ -50,7 +51,9 @@ plugins_sample = { class CoreConfig: def __init__(self) -> None: if OLD_CONFIG_PATH.exists(): - OLD_CONFIG_PATH.rename(CONFIG_PATH) + if not CONFIG_PATH.exists(): + shutil.copy2(OLD_CONFIG_PATH, CONFIG_PATH) + OLD_CONFIG_PATH.unlink() if not CONFIG_PATH.exists(): with open(CONFIG_PATH, 'w', encoding='UTF-8') as file: