WeChatMsg/app/util/path.py

22 lines
587 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-21 21:48:54 +08:00
# if os.path.exists(os.path.join())
2023-11-23 22:58:27 +08:00
# print(path, os.path.join(MePC().wx_dir, path), MePC().wx_dir)
2023-11-21 21:48:54 +08:00
output_path = dat2pic.decode_dat(os.path.join(MePC().wx_dir, path), './data/image')
2023-11-23 22:58:27 +08:00
2023-11-21 21:48:54 +08:00
return output_path
2023-11-20 23:08:10 +08:00
else:
2023-11-23 22:58:27 +08:00
return ':/icons/icons/404.png'