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?p=simantics%2Fplatform.git;a=commitdiff_plain;h=fac3394a0015e8f1b642bb59f97c814ea5d7ff1f;hp=39b62de8d2593275dfae8726772a636593e72e0e Replace file extension properly in FixExportedOntology gitlab #609 --- 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); }