/** * Initializes {@link ParsableFile parseable files} according to the current environment. * * @param packInfo the pack info fpor the current pack * @param parsables used to collect the read objects */ protected void readParsableFiles(PackInfo packInfo, List<ParsableFile> parsables) { for (ParsableFile parsableFile : packInfo.getParsables()) { logger.fine("Unpacked parsable: " + parsableFile.toString()); if (!parsableFile.hasCondition() || isConditionTrue(parsableFile.getCondition())) { String path = IoHelper.translatePath(parsableFile.getPath(), variables); parsableFile.setPath(path); parsables.add(parsableFile); } } }
if (!matcher.matchesCurrentPlatform(parsable.getOsConstraints())) File file = new File(parsable.getPath()); throw new IOException("Failed to create temporary file for " + parsable.getPath() + " in directory " + file.getParentFile(), exception); FileOutputStream outFile = new FileOutputStream(parsedFile); BufferedOutputStream out = new BufferedOutputStream(outFile, 5120); replacer.substitute(in, out, parsable.getType(), parsable.getEncoding()); in.close(); out.close();
if (target != null) ParsableFile parsable = new ParsableFile(target, type, encoding, osList); if (conditionId != null) parsable.setCondition(conditionId); for (String filePath : includedFiles) ParsableFile parsable = new ParsableFile(filePath, type, encoding, osList); if (conditionId != null) parsable.setCondition(conditionId);
oses.add(new OsModel("unix", null, null, null, null)); ParsableFile parsableFile = new ParsableFile(file.getAbsolutePath(), null, null, oses); ScriptParser scriptParser = new ScriptParser(replacer, matcher); scriptParser.parse(parsableFile);
/** * Parses {@link ParsableFile} instances collected during unpacking. * * @param files the files to parse * @throws InstallerException if parsing fails * @throws ResourceInterruptedException if installation is interrupted */ private void parseFiles(List<ParsableFile> files) { if (!files.isEmpty()) { ScriptParser parser = new ScriptParser(getVariableSubstitutor(), matcher); for (ParsableFile file : files) { try { parser.parse(file); } catch (Exception exception) { throw new InstallerException("Failed to parse: " + file.getPath(), exception); } checkInterrupt(); } } }