@Override public boolean isTrue() { return matcher.matchesCurrentPlatform(forOs); }
private void logIntro() { final String startMessage = messages.get("installer.started"); char[] chars = new char[startMessage.length()]; Arrays.fill(chars, '='); logger.info(new String(chars)); logger.info(startMessage); InputStream is = null; try { URL url = getClass().getClassLoader().getResource("META-INF/MANIFEST.MF"); is = url.openStream(); Manifest manifest = new Manifest(is); Attributes attr = manifest.getMainAttributes(); logger.info(messages.get("installer.version", attr.getValue("Created-By"))); } catch (IOException e) { logger.log(Level.WARNING, "IzPack version not found in manifest", e); } finally { IOUtils.closeQuietly(is); } logger.info(messages.get("installer.platform", matcher.getCurrentPlatform())); }
/** * Determines if the OS model matches the current platform. * * @param model the OS model * @return {@code true} if they match */ public boolean matchesCurrentPlatform(OsModel model) { return match(platform, model); }
boolean isUnix = matcher.getCurrentPlatform().isA(UNIX); if (!matcher.matchesCurrentPlatform(efile.osList))
/** * Determines if the current platform is in the specified list of models. * * @param models the models * @return {@code true} if the current platform is in the list of models, or if the models are {@code null} or * empty */ public boolean matchesCurrentPlatform(List<OsModel> models) { return matches(platform, models); }
if (!matcher.matchesCurrentPlatform(parsable.getOsConstraints()))
public GUIInstallData provide(Resources resources, Locales locales, DefaultVariables variables, Housekeeper housekeeper, PlatformModelMatcher matcher) throws Exception { final GUIInstallData guiInstallData = new GUIInstallData(variables, matcher.getCurrentPlatform()); // Loads the installation data loadInstallData(guiInstallData, resources, matcher, housekeeper); loadGUIInstallData(guiInstallData, resources); loadInstallerRequirements(guiInstallData, resources); loadDynamicVariables(variables, guiInstallData, resources); loadDynamicConditions(guiInstallData, resources); loadDefaultLocale(guiInstallData, locales); // Load custom langpack if exist. AbstractInstallDataProvider.addCustomLangpack(guiInstallData, locales); loadLookAndFeel(guiInstallData); if (UIManager.getColor("Button.background") != null) { guiInstallData.buttonsHColor = UIManager.getColor("Button.background"); } // ENTER always presses button in focus UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); return guiInstallData; }
if (match(platform, model))
for (Panel panel : installData.getPanelsOrder()) if (matcher.matchesCurrentPlatform(panel.getOsConstraints()))
public AutomatedInstallData provide(Resources resources, Locales locales, DefaultVariables variables, Housekeeper housekeeper, PlatformModelMatcher matcher) throws IOException, ClassNotFoundException, InstallerException { AutomatedInstallData automatedInstallData = new InstallData(variables, matcher.getCurrentPlatform()); // Loads the installation data loadInstallData(automatedInstallData, resources, matcher, housekeeper); loadInstallerRequirements(automatedInstallData, resources); loadDynamicVariables(variables, automatedInstallData, resources); loadDynamicConditions(automatedInstallData, resources); loadDefaultLocale(automatedInstallData, locales); // Load custom langpack if exist. AbstractInstallDataProvider.addCustomLangpack(automatedInstallData, locales); return automatedInstallData; }
if (matcher.matchesCurrentPlatform(osconstraints))
public ConsoleInstallData provide(Resources resources, Locales locales, DefaultVariables variables, Housekeeper housekeeper, PlatformModelMatcher matcher) throws Exception { final ConsoleInstallData consoleInstallData = new ConsoleInstallData(variables, matcher.getCurrentPlatform()); loadInstallData(consoleInstallData, resources, matcher, housekeeper); loadConsoleInstallData(consoleInstallData, resources); loadInstallerRequirements(consoleInstallData, resources); loadDynamicVariables(variables, consoleInstallData, resources); loadDynamicConditions(consoleInstallData, resources); loadDefaultLocale(consoleInstallData, locales); // Load custom langpack if exist. AbstractInstallDataProvider.addCustomLangpack(consoleInstallData, locales); return consoleInstallData; }
/** * Determines if a field is required if the field is required for the current platform and selected packs. * * @param field the field * @param installData the installation data * @param matcher the platform-model matcher * @return {@code true} if the field is required for the current platform and selected packs */ public static boolean isRequired(Field field, InstallData installData, PlatformModelMatcher matcher) { return isRequiredForPacks(field.getPacks(), installData.getSelectedPacks()) && matcher.matchesCurrentPlatform(field.getOsModels()); }
/** * Returns the search choices. * * @return the search choices */ public List<String> getChoices() { selected = -1; List<String> result = new ArrayList<String>(); Config config = getConfig(); IXMLElement spec = getSpec(); String set = config.getString(spec, "set", null); for (IXMLElement element : spec.getChildrenNamed("choice")) { List<OsModel> models = OsConstraintHelper.getOsList(element); if (matcher.matchesCurrentPlatform(models)) { String value = config.getString(element, "value", null); if( value.equals(set) ) { selected = result.size(); } result.add(value); } } return result; }
for (Pack pack : this.installData.getAllPacks()) if (matcher.matchesCurrentPlatform(pack.getOsConstraints()))
/** * Determines if a file should be unpacked. * * @param file the file to check * @return {@code true} if the file should be unpacked; {@code false} if it should be skipped */ private boolean shouldUnpack(PackFile file) { boolean result = true; if (file.hasCondition()) { result = isConditionTrue(file.getCondition()); } if (result && file.osConstraints() != null && !file.osConstraints().isEmpty()) { result = matcher.matchesCurrentPlatform(file.osConstraints()); } return result; }
for (Pack pack : this.automatedInstallData.getAllPacks()) if (matcher.matchesCurrentPlatform(pack.getOsConstraints()))
for (CustomData data : customData) if (matcher.matchesCurrentPlatform(data.osConstraints))
if (constraints.matchesCurrentPlatform(osConstraints))
if (matcher.matchesCurrentPlatform(constraints))