Skip to content
Snippets Groups Projects
Commit 34fbf561 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when importing zip file from max, ignore max specific "hidden" files

parent 4283ee4b
No related branches found
No related tags found
1 merge request!190Resolve "uploading zip file from MAC"
......@@ -114,6 +114,8 @@ public class ComplexZipConverter {
ZipEntry entry = entries.nextElement();
if (!entry.isDirectory()) {
ZipEntryFile zef = params.getEntry(entry.getName());
logger.debug(entry.getName());
logger.debug(zef);
if (zef instanceof ModelZipEntryFile) {
ModelZipEntryFile modelEntryFile = (ModelZipEntryFile) zef;
InputStream is = zipFile.getInputStream(entry);
......@@ -133,7 +135,7 @@ public class ComplexZipConverter {
// imageEntries.add((ImageZipEntryFile) zef);
} else if (zef instanceof DataMiningZipEntryFile) {
dataMiningSets.add(dataMiningZipEntryToDataMiningSet(zipFile, entry, (DataMiningZipEntryFile) zef));
} else {
} else if (!isIgnoredFile(entry.getName())) {
throw new NotImplementedException("Unknwon entry type: " + zef.getClass());
}
}
......@@ -181,6 +183,19 @@ public class ComplexZipConverter {
}
}
protected boolean isIgnoredFile(String name) {
if (name == null) {
return true;
} else if (name.isEmpty()) {
return true;
} else if (name.startsWith(".DS_Store")) {
return true;
} else if (name.startsWith("__MACOSX")) {
return true;
}
return false;
}
/**
* Process a single reaction in mapping file (transfomring reaction into
* connection between submodels).
......@@ -278,13 +293,12 @@ public class ComplexZipConverter {
String root = null;
String mapping = null;
logger.debug(params.getFilenames());
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (!entry.isDirectory()) {
String name = entry.getName();
ZipEntryFile zef = params.getEntry(name);
if (zef == null) {
if (zef == null && !isIgnoredFile(name)) {
throw new InvalidArgumentException("No information found in params about file: " + name);
}
if (zef instanceof ModelZipEntryFile) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment