getInnoSetupExec function
Locates the Inno Setup executable file, ensuring its proper installation.
Throws a ProcessException if Inno Setup is not found or is corrupted.
Implementation
File? getInnoSetupExec({bool throwIfNotFound = true}) {
if (!Directory(p.joinAll(innoSysDirPath)).existsSync() &&
!Directory(p.joinAll(innoUserDirPath)).existsSync()) {
if (throwIfNotFound) {
CliLogger.exitError("Inno Setup is not detected in your machine, "
"checkout our docs on how to correctly install it:\n"
"${CliLogger.sLink(innoDownloadStepLink, level: CliLoggerLevel.two)}");
}
return null;
}
final sysExec = p.joinAll([...innoSysDirPath, "ISCC.exe"]);
final sysExecFile = File(sysExec);
final userExec = p.joinAll([...innoUserDirPath, "ISCC.exe"]);
final userExecFile = File(userExec);
if (sysExecFile.existsSync()) return sysExecFile;
if (userExecFile.existsSync()) return userExecFile;
if (throwIfNotFound) {
CliLogger.exitError("Inno Setup installation in your machine is corrupted "
"or incomplete, checkout our docs on how to correctly install it:\n"
"${CliLogger.sLink(innoDownloadStepLink, level: CliLoggerLevel.two)}");
}
return null;
}