]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
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>
Wed, 30 Sep 2020 05:37:27 +0000 (08:37 +0300)
gitlab #609

(cherry picked from commit fac3394a0015e8f1b642bb59f97c814ea5d7ff1f)

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();
-               if (newName.contains("."))
-                       newName = newName.split("\\.")[0];
+               int lastDot = newName.lastIndexOf('.');
+               if (lastDot > -1)
+                       newName = newName.substring(0, lastDot);
                return p.resolveSibling(newName + newExtension);
        }