getWingetExec function

Future<String> getWingetExec()

Checks if Winget is installed on the system, and returns the path to the executable.

Implementation

Future<String> getWingetExec() async {
  final process = await Process.run('where.exe', ['winget']);

  final exitCode = process.exitCode;
  if (exitCode != 0) {
    CliLogger.error("Winget is not detected in your machine, "
        "Passing --install-inno-setup requires Winget to be installed.\n");
    exit(exitCode);
  }
  return process.stdout.toString().trim();
}