From: Tuukka Lehtonen Date: Thu, 24 Sep 2020 09:11:18 +0000 (+0300) Subject: Replace file extension properly in FixExportedOntology X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=adcb8de7070323f1f2f33865cfede520dec72333;p=simantics%2Fplatform.git Replace file extension properly in FixExportedOntology gitlab #609 (cherry picked from commit fac3394a0015e8f1b642bb59f97c814ea5d7ff1f) --- diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java index 17aa3ed26..33291cdf1 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java @@ -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); }