Generic function for running a commandlet with its arguments.
(name, arguments)
| 39 | |
| 40 | |
| 41 | def invoke_commandlet(name, arguments): |
| 42 | """Generic function for running a commandlet with its arguments.""" |
| 43 | ue4_path = os.environ["UE4_ROOT"] |
| 44 | uproject_path = os.path.join(CARLA_ROOT_PATH, "Unreal", "CarlaUE4", "CarlaUE4.uproject") |
| 45 | run = "-run=%s" % (name) |
| 46 | |
| 47 | if os.name == "nt": |
| 48 | sys_name = "Win64" |
| 49 | editor_path = "%s/Engine/Binaries/%s/UE4Editor" % (ue4_path, sys_name) |
| 50 | command = [editor_path, uproject_path, run] |
| 51 | command.extend(arguments) |
| 52 | print("Commandlet:", command) |
| 53 | subprocess.check_call(command, shell=True) |
| 54 | elif os.name == "posix": |
| 55 | sys_name = "Linux" |
| 56 | editor_path = "%s/Engine/Binaries/%s/UE4Editor" % (ue4_path, sys_name) |
| 57 | full_command = "%s %s %s %s" % (editor_path, uproject_path, run, " ".join(arguments)) |
| 58 | print("Commandlet:", full_command) |
| 59 | subprocess.call([full_command], shell=True) |
| 60 | |
| 61 | |
| 62 |
no test coverage detected