Skip to content

Conversation

@Platohykj
Copy link

This pull request improves the robustness of the InnoSetupCompiler by adding a fallback mechanism for locating the Inno Setup compiler executable. Instead of failing if the default installation directory is not found, the code now attempts to use ISCC from the system PATH before throwing an error.

Improvements to Inno Setup compiler execution:

  • Updated the compile method in inno_setup_compiler.dart to first try running ISCC.exe from the default installation directory, and if not found, fall back to invoking ISCC from the system PATH. Throws a clear exception if neither is available.

Copilot AI review requested due to automatic review settings December 17, 2025 15:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Inno Setup 6 compiler detection by adding a fallback mechanism. Instead of immediately failing when the default installation directory doesn't exist, the code now attempts to find and use ISCC from the system PATH before throwing an error.

Key changes:

  • Moves script file creation to the beginning of the method
  • Adds conditional logic to check for the default installation path first
  • Implements PATH-based fallback for ISCC execution when default path is not found
  • Updates error message to reflect both possible failure scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 28 to 30
throw Exception(
'`Inno Setup 6` was not installed or ISCC is not in PATH.');
}
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The temporary file is not cleaned up when an exception is thrown. If the compiler is not found in PATH (line 28-30), the exception is thrown before file.deleteSync() is called (line 37). This will leave temporary script files on disk. Consider using a try-finally block to ensure cleanup, or moving file deletion earlier to handle all error paths.

Copilot uses AI. Check for mistakes.
Comment on lines 17 to 31
if (innoSetupDirectory.existsSync()) {
// Use ISCC from the default installation directory
processResult = await $(
p.join(innoSetupDirectory.path, 'ISCC.exe'),
[file.path],
);
} else {
// Fall back to PATH
try {
processResult = await $('ISCC', [file.path]);
} on ProcessException {
throw Exception(
'`Inno Setup 6` was not installed or ISCC is not in PATH.');
}
}
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling logic is incomplete. When the default installation path exists but ISCC.exe is not found or fails to execute (e.g., due to missing file), a ProcessException will be thrown but won't be caught. This will result in an uncaught exception instead of the clear error message intended for users. The try-catch should wrap both branches, or the first branch should also have explicit error handling.

Copilot uses AI. Check for mistakes.
…no_setup_compiler.dart

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant