| 48 | |
| 49 | |
| 50 | def find_advinst() -> Path: |
| 51 | if env := os.environ.get("ADVINST"): |
| 52 | path = Path(env) |
| 53 | if not path.exists(): |
| 54 | sys.exit(f"ADVINST={env} does not exist.") |
| 55 | return path |
| 56 | candidates = sorted( |
| 57 | Path(r"C:\Program Files (x86)\Caphyon").glob( |
| 58 | "Advanced Installer*/bin/x86/AdvancedInstaller.com" |
| 59 | ) |
| 60 | ) |
| 61 | if not candidates: |
| 62 | sys.exit( |
| 63 | "AdvancedInstaller.com not found under C:\\Program Files (x86)\\Caphyon. " |
| 64 | "Set the ADVINST environment variable to its full path." |
| 65 | ) |
| 66 | return candidates[-1] |
| 67 | |
| 68 | |
| 69 | def run(advinst: Path, *edit_args: str, check: bool = True) -> int: |