List of usage examples for org.eclipse.jgit.util FS exists
public boolean exists(File path)
From source file:com.itemis.maven.plugins.unleash.scm.providers.merge.UnleashGitMerger.java
License:Eclipse Distribution License
/** * Writes merged file content to the working tree. * * @param result//from w w w . j a va2 s.com * the result of the content merge * @return the working tree file to which the merged content was written. * @throws FileNotFoundException * @throws IOException */ private File writeMergedFile(MergeResult<RawText> result) throws FileNotFoundException, IOException { File workTree = this.db.getWorkTree(); FS fs = this.db.getFS(); File of = new File(workTree, this.tw.getPathString()); File parentFolder = of.getParentFile(); if (!fs.exists(parentFolder)) { parentFolder.mkdirs(); } OutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream(of)); new MergeFormatter().formatMerge(os, result, Arrays.asList(this.commitNames), CHARACTER_ENCODING); } finally { Closeables.close(os, true); } return of; }