[#2341] Sanitize groupnames
This commit is contained in:
parent
19854154b4
commit
d36b5d3e9d
@ -154,6 +154,7 @@ public class OBJExporterFactory {
|
|||||||
|
|
||||||
// Component exporting
|
// Component exporting
|
||||||
String groupName = idx + "_" + component.getName();
|
String groupName = idx + "_" + component.getName();
|
||||||
|
groupName = sanitizeGroupName(groupName);
|
||||||
handleComponent(obj, this.configuration, this.options.getTransformer(), component, groupName,
|
handleComponent(obj, this.configuration, this.options.getTransformer(), component, groupName,
|
||||||
materials.get(obj), this.options.getLOD(), options, warnings);
|
materials.get(obj), this.options.getLOD(), options, warnings);
|
||||||
|
|
||||||
@ -293,6 +294,20 @@ public class OBJExporterFactory {
|
|||||||
return sortedComponents;
|
return sortedComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize the group name by replacing illegal characters with underscores.
|
||||||
|
* @param groupName the group name to sanitize
|
||||||
|
* @return the sanitized group name
|
||||||
|
*/
|
||||||
|
private static String sanitizeGroupName(String groupName) {
|
||||||
|
Character c = FileUtils.getIllegalFilenameChar(groupName);
|
||||||
|
while (c != null) {
|
||||||
|
groupName = groupName.replace(c, '_');
|
||||||
|
c = FileUtils.getIllegalFilenameChar(groupName);
|
||||||
|
}
|
||||||
|
return groupName;
|
||||||
|
}
|
||||||
|
|
||||||
private void addChildComponentToList(RocketComponent parent, Set<RocketComponent> components, Set<RocketComponent> sortedComponents) {
|
private void addChildComponentToList(RocketComponent parent, Set<RocketComponent> components, Set<RocketComponent> sortedComponents) {
|
||||||
for (RocketComponent child : parent.getChildren()) {
|
for (RocketComponent child : parent.getChildren()) {
|
||||||
if (components.contains(child)) {
|
if (components.contains(child)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user