Moved Rocksim saving condition to the top of save, since there is no
need to do all the decal name manipulation if we don't save decals in Rocksim files.
This commit is contained in:
parent
079ef2ba13
commit
618dd63b5c
@ -147,13 +147,14 @@ public class GeneralRocketSaver {
|
|||||||
|
|
||||||
private void save(String fileName, OutputStream output, OpenRocketDocument document, StorageOptions options) throws IOException {
|
private void save(String fileName, OutputStream output, OpenRocketDocument document, StorageOptions options) throws IOException {
|
||||||
|
|
||||||
/* if we want a directory ...
|
// For now, we don't save decal inforamtion in ROCKSIM files, so don't do anything
|
||||||
String path = fileName;
|
// which follows.
|
||||||
int dotlocation = fileName.lastIndexOf('.');
|
// TODO - add support for decals in ROCKSIM files?
|
||||||
if ( dotlocation > 1 ) {
|
if ( options.getFileType() == FileType.ROCKSIM ) {
|
||||||
path = fileName.substring(dotlocation);
|
saveInternal(output, document, options);
|
||||||
|
output.close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// grab the set of decal images. We do this up front
|
// grab the set of decal images. We do this up front
|
||||||
// so we can fail early if some resource is missing.
|
// so we can fail early if some resource is missing.
|
||||||
@ -230,12 +231,12 @@ public class GeneralRocketSaver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we have to loop through all the components and update their names.
|
// Now we have to loop through all the components and update their names.
|
||||||
// FIXME - we probably don't want to modify the existing document.
|
|
||||||
// Suppose the user has been using a couple of decal files from the file system.
|
// First we copy the OpenRocketDocument so we can modify the decal file names
|
||||||
// He currently is editing some decal files, but decides to do an itermediate save.
|
// without changing the ui's copy. This is so the ui will continue to
|
||||||
// The saved file should contain references to the decal copied into the zip container,
|
// use the exported decals.
|
||||||
// however, the currently open document should still be looking at the filesystem copy.
|
OpenRocketDocument rocketDocCopy = document.copy();
|
||||||
for( RocketComponent c : document.getRocket() ) {
|
for( RocketComponent c : rocketDocCopy.getRocket() ) {
|
||||||
|
|
||||||
if ( c.getAppearance() == null ) {
|
if ( c.getAppearance() == null ) {
|
||||||
continue;
|
continue;
|
||||||
@ -261,12 +262,8 @@ public class GeneralRocketSaver {
|
|||||||
String newName = decalNameNormalization.get(image.getKey());
|
String newName = decalNameNormalization.get(image.getKey());
|
||||||
decalMap.put(newName, image.getValue());
|
decalMap.put(newName, image.getValue());
|
||||||
}
|
}
|
||||||
if ( options.getFileType() == FileType.OPENROCKET ) {
|
|
||||||
saveAllPartsZipFile(fileName, output, document, options, decalMap);
|
saveAllPartsZipFile(fileName, output, rocketDocCopy, options, decalMap);
|
||||||
} else {
|
|
||||||
saveInternal(output, document, options);
|
|
||||||
output.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveAllPartsZipFile(String fileName, OutputStream output, OpenRocketDocument document, StorageOptions options, Map<String,InputStream> decals) throws IOException {
|
public void saveAllPartsZipFile(String fileName, OutputStream output, OpenRocketDocument document, StorageOptions options, Map<String,InputStream> decals) throws IOException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user