Replace file extension properly in FixExportedOntology
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 24 Sep 2020 09:11:18 +0000 (12:11 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 24 Sep 2020 09:11:18 +0000 (12:11 +0300)
gitlab #609

bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java

index 17aa3ed26af30ab5143a2cacf7fb16b01d2a27d3..33291cdf108e75cef32b35e64e69b19d8583c589 100644 (file)
@@ -41,8 +41,9 @@ public class FixExportedOntology {
 
        private static Path replaceExtension(Path p, String newExtension) {
                String newName = p.getFileName().toString();
 
        private static Path replaceExtension(Path p, String newExtension) {
                String newName = p.getFileName().toString();
-               if (newName.contains("."))
-                       newName = newName.split("\\.")[0];
+               int lastDot = newName.lastIndexOf('.');
+               if (lastDot > -1)
+                       newName = newName.substring(0, lastDot);
                return p.resolveSibling(newName + newExtension);
        }
 
                return p.resolveSibling(newName + newExtension);
        }