--- /dev/null
+package org.simantics.export.core.impl;\r
+\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class PublisherUtil {\r
+\r
+ /**\r
+ * Returns either filePath as is or filePath suffixed by\r
+ * <code>endsWith</code> depending on whether <code>filePath</code> ends\r
+ * with <code>endsWith</code> or not.\r
+ * \r
+ * @param suffix\r
+ * @param ignoreCase\r
+ * @param filePath\r
+ * @return\r
+ */\r
+ public static String ensureEndsWith(boolean ignoreCase, String suffix, String filePath) {\r
+ int suffixLen = suffix.length();\r
+ int filePathLen = filePath.length();\r
+ if (suffixLen > filePathLen)\r
+ return filePath + suffix;\r
+ if (!filePath.regionMatches(ignoreCase, filePathLen - suffixLen, suffix, 0, suffixLen))\r
+ return filePath + suffix;\r
+ return filePath;\r
+ }\r
+\r
+}\r