/** * Creates the directory named by this abstract pathname, including any * necessary but nonexistent parent directories. Note that if this operation * fails it may have succeeded in creating some of the necessary parent * directories. * * @param d * directory to be created * @throws java.io.IOException * if creation of {@code d} fails. This may occur if {@code d} * did exist when the method was called. This can therefore * cause java.io.IOExceptions during race conditions when * multiple concurrent threads all try to create the same * directory. */ public static void mkdirs(File d) throws IOException { mkdirs(d, false); }
/** {@inheritDoc} */ @Override public void create() throws IOException { FileUtils.mkdirs(objects); FileUtils.mkdir(infoDirectory); FileUtils.mkdir(packDirectory); }
private File getFile(String path, boolean create) throws PatchApplyException { File f = new File(getRepository().getWorkTree(), path); if (create) try { File parent = f.getParentFile(); FileUtils.mkdirs(parent, true); FileUtils.createNewFile(f); } catch (IOException e) { throw new PatchApplyException(MessageFormat.format( JGitText.get().createNewFileFailed, f), e); } return f; }
private void checkoutGitlink(String path, DirCacheEntry entry) throws IOException { File gitlinkDir = new File(repo.getWorkTree(), path); FileUtils.mkdirs(gitlinkDir, true); FS fs = repo.getFS(); entry.setLastModified(fs.lastModified(gitlinkDir)); }
/** * Try to establish the lock. * * @return true if the lock is now held by the caller; false if it is held * by someone else. * @throws java.io.IOException * the temporary output file could not be created. The caller * does not hold the lock. */ public boolean lock() throws IOException { FileUtils.mkdirs(lck.getParentFile(), true); token = FS.DETECTED.createNewFileAtomic(lck); if (token.isCreated()) { haveLck = true; try { os = new FileOutputStream(lck); } catch (IOException ioe) { unlock(); throw ioe; } } else { closeToken(); } return haveLck; }
/** * Creates the directory named by this abstract pathname, including any * necessary but nonexistent parent directories. Note that if this operation * fails it may have succeeded in creating some of the necessary parent * directories. * * @param d * directory to be created * @throws IOException * if creation of {@code d} fails. This may occur if {@code d} * did exist when the method was called. This can therefore * cause IOExceptions during race conditions when multiple * concurrent threads all try to create the same directory. */ public static void mkdirs(final File d) throws IOException { mkdirs(d, false); }
/** * Creates the directory named by this abstract pathname, including any * necessary but nonexistent parent directories. Note that if this operation * fails it may have succeeded in creating some of the necessary parent * directories. * * @param d * directory to be created * @throws java.io.IOException * if creation of {@code d} fails. This may occur if {@code d} * did exist when the method was called. This can therefore * cause java.io.IOExceptions during race conditions when * multiple concurrent threads all try to create the same * directory. */ public static void mkdirs(File d) throws IOException { mkdirs(d, false); }
File f = new File(repo.getWorkTree(), entry.getPathString()); File parentDir = f.getParentFile(); FileUtils.mkdirs(parentDir, true); FS fs = repo.getFS(); WorkingTreeOptions opt = repo.getConfig().get(WorkingTreeOptions.KEY);
JGitText.get().repositoryAlreadyExists, getDirectory())); FileUtils.mkdirs(getDirectory(), true); HideDotFiles hideDotFiles = getConfig().getEnum( ConfigConstants.CONFIG_CORE_SECTION, null,
/** * Creates a unique directory for a test * * @param name * a subdirectory * @return a unique directory for a test * @throws IOException */ protected File createTempDirectory(String name) throws IOException { File directory = new File(createTempFile(), name); FileUtils.mkdirs(directory); return directory.getCanonicalFile(); }
/** * Creates a unique directory for a test * * @param name * a subdirectory * @return a unique directory for a test * @throws IOException */ protected File createTempDirectory(String name) throws IOException { File directory = new File(createTempFile(), name); FileUtils.mkdirs(directory); return directory.getCanonicalFile(); }
/** * Creates a unique directory for a test * * @param name * a subdirectory * @return a unique directory for a test * @throws IOException */ protected File createTempDirectory(String name) throws IOException { File directory = new File(createTempFile(), name); FileUtils.mkdirs(directory); return directory.getCanonicalFile(); }
/** * Write a string as a UTF-8 file. * * @param f * file to write the string to. Caller is responsible for making * sure it is in the trash directory or will otherwise be cleaned * up at the end of the test. If the parent directory does not * exist, the missing parent directories are automatically * created. * @param body * content to write to the file. * @throws IOException * the file could not be written. */ public static void write(File f, String body) throws IOException { FileUtils.mkdirs(f.getParentFile(), true); try (Writer w = new OutputStreamWriter(new FileOutputStream(f), UTF_8)) { w.write(body); } }
/** * Write a string as a UTF-8 file. * * @param f * file to write the string to. Caller is responsible for making * sure it is in the trash directory or will otherwise be cleaned * up at the end of the test. If the parent directory does not * exist, the missing parent directories are automatically * created. * @param body * content to write to the file. * @throws IOException * the file could not be written. */ public static void write(final File f, final String body) throws IOException { FileUtils.mkdirs(f.getParentFile(), true); Writer w = new OutputStreamWriter(new FileOutputStream(f), "UTF-8"); try { w.write(body); } finally { w.close(); } }
/** * Try to establish the lock. * * @return true if the lock is now held by the caller; false if it is held * by someone else. * @throws IOException * the temporary output file could not be created. The caller * does not hold the lock. */ public boolean lock() throws IOException { FileUtils.mkdirs(lck.getParentFile(), true); if (lck.createNewFile()) { haveLck = true; try { os = new FileOutputStream(lck); } catch (IOException ioe) { unlock(); throw ioe; } } return haveLck; }
@Override public void create() throws IOException { FileUtils.mkdirs(objects); FileUtils.mkdir(infoDirectory); FileUtils.mkdir(packDirectory); }
/** {@inheritDoc} */ @Override public void create() throws IOException { FileUtils.mkdirs(objects); FileUtils.mkdir(infoDirectory); FileUtils.mkdir(packDirectory); }
private File getFile(String path, boolean create) throws PatchApplyException { File f = new File(getRepository().getWorkTree(), path); if (create) try { File parent = f.getParentFile(); FileUtils.mkdirs(parent, true); FileUtils.createNewFile(f); } catch (IOException e) { throw new PatchApplyException(MessageFormat.format( JGitText.get().createNewFileFailed, f), e); } return f; }
private File getFile(String path, boolean create) throws PatchApplyException { File f = new File(getRepository().getWorkTree(), path); if (create) try { File parent = f.getParentFile(); FileUtils.mkdirs(parent, true); FileUtils.createNewFile(f); } catch (IOException e) { throw new PatchApplyException(MessageFormat.format( JGitText.get().createNewFileFailed, f), e); } return f; }
private void checkoutGitlink(String path, DirCacheEntry entry) throws IOException { File gitlinkDir = new File(repo.getWorkTree(), path); FileUtils.mkdirs(gitlinkDir, true); FS fs = repo.getFS(); entry.setLastModified(fs.lastModified(gitlinkDir)); }