/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }
/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
/** * Creates the directory named by this file, assuming its parents exist. * Use {@link #mkdirs} if you also want to create missing parents. * * <p>Note that this method does <i>not</i> throw {@code IOException} on failure. * Callers must check the return value. Note also that this method returns * false if the directory already existed. If you want to know whether the * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())} * or simply ignore the return value from this method and simply call {@link #isDirectory}. * * @return {@code true} if the directory was created, * {@code false} on failure or if the directory already existed. */ public boolean mkdir() { try { mkdirErrno(); return true; } catch (ErrnoException errnoException) { return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }
private boolean mkdirs(boolean resultIfExists) { try { // Try to create the directory directly. mkdirErrno(); return true; } catch (ErrnoException errnoException) { if (errnoException.errno == ENOENT) { // If the parent was missing, try to create it and then try again. File parent = getParentFile(); return parent != null && parent.mkdirs(true) && mkdir(); } else if (errnoException.errno == EEXIST) { return resultIfExists; } return false; } }