/*
- * jSite - ProjectInserter.java - Copyright © 2006–2012 David Roden
+ * jSite - ProjectInserter.java - Copyright © 2006–2014 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* {@link ClientPutComplexDir#addFileEntry(FileEntry)}.
*
* @param file
- * The name and hash of the file to insert
- * @param edition
- * The current edition
+ * The name and hash of the file to insert
* @return A file entry for the given file
*/
- private FileEntry createFileEntry(ScannedFile file, int edition) {
+ private FileEntry createFileEntry(ScannedFile file) {
String filename = file.getFilename();
FileOption fileOption = project.getFileOption(filename);
if (fileOption.isInsert()) {
String dirURI = "USK@" + project.getInsertURI() + "/" + project.getPath() + "/" + edition + "/";
ClientPutComplexDir putDir = new ClientPutComplexDir("dir-" + counter++, dirURI, tempDirectory);
if ((project.getIndexFile() != null) && (project.getIndexFile().length() > 0)) {
- putDir.setDefaultName(project.getIndexFile());
+ FileOption indexFileOption = project.getFileOption(project.getIndexFile());
+ Optional<String> changedName = indexFileOption.getChangedName();
+ if (changedName.isPresent()) {
+ putDir.setDefaultName(changedName.get());
+ } else {
+ putDir.setDefaultName(project.getIndexFile());
+ }
}
putDir.setVerbosity(Verbosity.ALL);
putDir.setMaxRetries(-1);
putDir.setPriorityClass(priority);
putDir.setManifestPutter(manifestPutter);
for (ScannedFile file : files) {
- FileEntry fileEntry = createFileEntry(file, edition);
+ FileEntry fileEntry = createFileEntry(file);
if (fileEntry != null) {
try {
putDir.addFileEntry(fileEntry);