installInnoSetup function

Future<void> installInnoSetup()

Installs Inno Setup into your system if not already installed with Winget.

Implementation

Future<void> installInnoSetup() async {
  final innoSetupExec = getInnoSetupExec(throwIfNotFound: false);
  if (innoSetupExec != null) {
    CliLogger.info("Inno Setup is already installed.");
    return;
  }

  final wingetExec = await getWingetExec();
  final wingetFile = File(wingetExec);

  final process = await Process.start(
    wingetFile.path,
    innoSetupInstallationSubCommand,
    runInShell: true,
    workingDirectory: Directory.current.path,
    mode: ProcessStartMode.inheritStdio,
  );

  final exitCode = await process.exitCode;
  if (exitCode != 0) exit(exitCode);
}