isNotAWindowsExecutable method
Returns true if the input file exists but is NOT a Windows executable.
This is the usual case when building on another platform: there's no Windows Subsystem to set, and it's not a build error.
Implementation
bool isNotAWindowsExecutable(Directory rootDirectory) {
var inputFile = File(resolveInputPath(rootDirectory));
// A missing or unreadable input file IS an error, reported by `execute`:
if (!inputFile.existsSync()) return false;
try {
return !WindowsPEFile(inputFile).isValidExecutable;
} catch (_) {
return false;
}
}