void (@NotNull CompositePackagingElement<?> root, @NotNull String outputDirectoryPath, @NotNull String sourceFilePath, @Nullable String outputFileName, boolean addAsFirstChild) { final String fileName = PathUtil.getFileName(sourceFilePath); if (outputFileName != null && outputFileName.equals(fileName)) { outputFileName = null; } CompositePackagingElement<?> parent = getOrCreateDirectoryOrArchive(root, outputDirectoryPath, true, true); PackagingElement<?> child = createFileCopy(sourceFilePath, outputFileName); if (addAsFirstChild) { parent.addFirstChild(child); } else { parent.addOrFindChild(child); } }