EG/Start_Run.py
2025-12-12 16:16:15 +08:00

37 lines
1.1 KiB
Python

import os
import sys
# 添加项目根目录到 Python 路径
project_root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, project_root)
# 设置工作目录为项目根目录
os.chdir(project_root)
# 添加 RenderPipeline 到路径(注意路径名称应与实际目录一致)
render_pipeline_path = os.path.join(project_root, "RenderPipeline")
sys.path.insert(0, render_pipeline_path)
# 添加 RenderPipelineFile 路径
render_pipeline_file_path = os.path.join(project_root, "RenderPipelineFile")
sys.path.insert(0, render_pipeline_file_path)
# 添加 icons 目录到路径
icons_path = os.path.join(project_root, "icons")
sys.path.insert(0, icons_path)
# 现在可以导入并运行主程序
if __name__ == "__main__":
args = sys.argv[1:]
# args = "/home/tiger/桌面/Test1"
# args = "C:/Users/29381/Desktop/1"
print(f'Path is {args}')
# 将整个列表转换为字符串(包括方括号)
args_str = ''.join(args)
from main import run
if args:
run(args_str)
# run(args)
else:
run()