Arbitrary prefixes can cut words or numbers in silly places. Only allow
truncating at common separator characters.
prefix = o.name
for c in clones:
- for i in range(min(len(c.name), len(prefix))):
- if c.name[i]!=prefix[i]:
- prefix = prefix[:i]
- break
+ while not c.name.startswith(prefix):
+ pos = max(prefix.rfind(' '), prefix.rfind('.'))
+ if pos<0:
+ break;
+ prefix = prefix[:pos]
if prefix:
export_names[o.name+".object"] = prefix.strip(" .")+".object"