ReleasePackerWindowsSubsystemCommand.fromList constructor

ReleasePackerWindowsSubsystemCommand.fromList(
  1. List list
)

Implementation

factory ReleasePackerWindowsSubsystemCommand.fromList(List list) {
  var listStr = list.map((e) => '$e').toList();

  if (listStr.first == 'release_utility') {
    listStr.removeAt(0);
  }

  var argGuiIdx = listStr.indexOf('--windows-gui');
  var argConsoleIdx = listStr.indexOf('--windows-console');

  var argGUI = false;
  if (argGuiIdx >= 0) {
    listStr.removeAt(argGuiIdx);
    argGUI = true;
  }

  if (argConsoleIdx >= 0) {
    listStr.removeAt(argConsoleIdx);
    argGUI = false;
  }

  var executable =
      listStr.firstWhereOrNull((e) => e.endsWith('.exe')) ?? listStr.first;

  var output =
      listStr.lastWhereOrNull((e) => e.endsWith('.exe')) ?? listStr.last;

  return ReleasePackerWindowsSubsystemCommand(argGUI, executable, output);
}