mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
27.17.2014 6f5e10b0dc596c8e7625de7ddf523b6d5bc220c7
opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
@@ -489,6 +489,23 @@
        return msg;
    }
    /**
     * Returns <CODE>true</CODE> if we can write on the provided path and <CODE>false</CODE> otherwise.
     *
     * @param path
     *            the path.
     * @return <CODE>true</CODE> if we can write on the provided path and <CODE>false</CODE> otherwise.
     */
    public static boolean canWrite(String path) {
        final File file = new File(path);
        if (file.exists()) {
            return file.canWrite();
        }
        final File parentFile = file.getParentFile();
        return (parentFile != null && parentFile.canWrite());
    }
    // Prevent instantiation.
    private Utils() {
        // Do nothing.