"""Relocate temporary resource paths in an isolated copy of a saved startup Main.""" from pathlib import Path import sys import bpy sys.path.insert(0,str(Path(__file__).resolve().parent)) from native_resources import portable_resource_paths startup,workspace,destination=map(Path,sys.argv[sys.argv.index('--')+1:]) bpy.ops.wm.open_mainfile(filepath=str(startup),load_ui=True,use_scripts=False) portable_resource_paths(workspace,destination) state=bpy.ops.wm.save_as_mainfile(filepath=str(startup),copy=True,relative_remap=False) if 'FINISHED' not in state:raise RuntimeError('STARTUP_RESOURCE_REWRITE_FAILED')