AsciiDocFileUtils { static String calculatePathToFileFromBase(File asciidoctorFile, File baseDir) { String unixBasePath = FilenameUtils.normalizeNoEndSeparator(baseDir.getAbsolutePath(), true) + "/"; String unixAsciiDocFilePath = FilenameUtils.normalize(asciidoctorFile.getAbsolutePath(), true); if (unixAsciiDocFilePath.startsWith(unixBasePath)) { return unixAsciiDocFilePath.substring(unixBasePath.length()); } throw new NotInsideCurrentBaseDirException("pathProblems:" + unixAsciiDocFilePath + " not in " + unixBasePath); }  static File createTempFileForConvertedContent(Path tempFolder, long editorId, String filename); static Path createTempFolderForId(String projectId); static File createEncodingSafeFile(Path path, String name); static File createHiddenEditorFile(LogAdapter logAdapter, File asciidoctorFile, long editorId, File baseDir, Path tempFolder);  }
@Test public void calculatePathToFileFromBase() { File file = new File("./"); File asciiDocFile = new File(file,"basefolder/sub1/sub2/sub3/test.adoc"); File baseDir = new File(file,"basefolder"); String path = AsciiDocFileUtils.calculatePathToFileFromBase(asciiDocFile, baseDir); assertEquals("sub1/sub2/sub3/test.adoc",path); }