+ * Performs a case-sensitive check that the href'd file exists
+ *
+ * @param hrefFile
+ * @return
+ * @throws IOException
+ */
+ boolean fileExists(File hrefFile, String href) throws IOException
+ {
+ if (!hrefFile.exists())
+ {
+ return false;
+ }
+
+ /*
+ * On Mac or Windows, file.exists() is not case sensitive, so do an
+ * additional check with case sensitivity
+ */
+ int slashPos = href.lastIndexOf("/");
+ String expectedFileName = slashPos == -1 ? href : href
+ .substring(slashPos + 1);
+ String cp = hrefFile.getCanonicalPath();
+ slashPos = cp.lastIndexOf("/");
+ String actualFileName = slashPos == -1 ? cp : cp
+ .substring(slashPos + 1);
+
+ return expectedFileName.equals(actualFileName);
+ }
+
+ /**