From 8020d24226426992a797bd87dea73f11215fe841 Mon Sep 17 00:00:00 2001 From: lededev Date: Mon, 14 Jun 2021 12:56:43 +0800 Subject: [PATCH] optimize code logic and tighten restrictions --- core.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core.py b/core.py index ecb4446..2f1b0af 100644 --- a/core.py +++ b/core.py @@ -590,18 +590,12 @@ def add_to_pic(pic_path, img_pic, size, count, mode): mark_pic_path = '' # 先找pyinstaller打包的图片 base_path = '' - if hasattr(sys, '_MEIPASS'): + if hasattr(sys, '_MEIPASS') and os.path.isfile(os.path.join(getattr(sys, '_MEIPASS'),"Img/SUB.png")): base_path = getattr(sys, '_MEIPASS') - if base_path and os.path.isfile(os.path.join(base_path,"Img/SUB.png")): - if mode == 1: - mark_pic_path = os.path.join(base_path, "Img/SUB.png") - elif mode == 2: - mark_pic_path = os.path.join(base_path, "Img/LEAK.png") - elif mode == 3: - mark_pic_path = os.path.join(base_path, "Img/UNCENSORED.png") # 再找py脚本所在路径的图片 elif os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)),"Img/SUB.png")): base_path = os.path.dirname(os.path.realpath(__file__)) + if len(base_path) > 0 and os.path.isdir(base_path): if mode == 1: mark_pic_path = os.path.join(base_path, "Img/SUB.png") elif mode == 2: