Difficult-Rocket/DR-start.py

53 lines
1.2 KiB
Python
Raw Normal View History

2022-07-04 15:12:04 +08:00
# -------------------------------
# Difficult Rocket
2023-01-20 14:08:12 +08:00
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
2022-07-04 15:12:04 +08:00
# All rights reserved
# -------------------------------
2023-07-11 18:34:43 +08:00
2022-11-11 09:33:34 +08:00
import os
import sys
import time
2023-07-11 18:34:43 +08:00
from pathlib import Path
2022-11-11 09:33:34 +08:00
hi = """Difficult Rocket is writen by shenjackyuanjie
2023-01-02 19:46:25 +08:00
email: 3695888@qq.com or shyj3695888@163.com
2022-11-11 09:33:34 +08:00
QQ: 3695888"""
def print_path() -> None:
print(f'{__file__=}')
print(f'{sys.path=}')
print(f'{sys.path[0]=}')
print(f'{sys.argv[0]=}')
2023-07-11 18:34:43 +08:00
print(f'{Path.cwd()=}')
print(f'{Path(__file__).absolute()=}')
def modify_path() -> None:
2023-07-11 18:34:43 +08:00
os.chdir(Path(__file__)) # 将运行路径切换到文件位置 防止bug
sys.path.append(f'./Difficult_Rocket') # 添加local path
sys.path.append(f'./libs') # 添加 libs path
def start(start_time_ns: int) -> None:
from Difficult_Rocket import main
from Difficult_Rocket.runtime import DR_runtime
DR_runtime.start_time_ns = start_time_ns
try:
main_game = main.Game()
except Exception as exp:
2022-11-11 09:33:34 +08:00
if __name__ == '__main__':
2023-07-11 18:34:43 +08:00
print(hi, f"\n{time.ctime()}") # hi
2022-11-11 09:33:34 +08:00
# 记录启动信息
start_time_ns = time.time_ns()
print_path()
modify_path()
2023-07-11 18:34:43 +08:00
start(start_time_ns)