From 8a9207566a86cdd17360022c4cc0b2257c095289 Mon Sep 17 00:00:00 2001 From: yshtcn Date: Thu, 12 Oct 2023 21:39:22 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0docker=E6=83=85=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Diary Assistant.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Diary Assistant.py b/Diary Assistant.py index ccbfc2c..937b267 100644 --- a/Diary Assistant.py +++ b/Diary Assistant.py @@ -12,10 +12,15 @@ TOKEN = None -# 定义当前脚本所在目录(如果是frozen的使用exe所在的目录) +# 定义当前脚本所在目录 current_dir = os.path.dirname(os.path.abspath(__file__)) +#如果是frozen的使用exe所在的目录 if getattr(sys, 'frozen', False): current_dir = os.path.dirname(sys.executable) +#如果是docker,设置为data目录 +if os.path.exists('/.dockerenv'): + current_dir = '/data' + # 定义配置文件名 config_filename = "bot_config.json"