WeChatMsg/app/util/path.py

20 lines
576 B
Python
Raw Normal View History

2023-11-20 23:08:10 +08:00
import os
2023-11-23 22:58:27 +08:00
from app.person_pc import MePC
2023-11-24 23:49:37 +08:00
from app.util import dat2pic
2023-11-20 23:08:10 +08:00
2023-11-25 00:20:35 +08:00
if not os.path.exists('./data/'):
os.mkdir('./data/')
2023-11-21 21:48:54 +08:00
if not os.path.exists('./data/image'):
os.mkdir('./data/image')
2023-11-20 23:08:10 +08:00
def get_abs_path(path):
2023-11-21 21:48:54 +08:00
# return os.path.join(os.getcwd(), 'app/data/icons/404.png')
2023-11-20 23:08:10 +08:00
if path:
2023-11-27 19:26:31 +08:00
base_path = os.getcwd() + "/data/image"
2023-11-28 21:51:49 +08:00
output_path = dat2pic.decode_dat(os.path.join(MePC().wx_dir, path), base_path) # './data/image')
return output_path if output_path else ':/icons/icons/404.png'
2023-11-20 23:08:10 +08:00
else:
2023-11-23 22:58:27 +08:00
return ':/icons/icons/404.png'