Java Root Directory Get getRootDir()

Here you can find the source of getRootDir()

Description

get Root Dir

License

Open Source License

Declaration

private static File getRootDir() throws IOException 

Method Source Code


//package com.java2s;
/*/*from ww w.j a va 2  s . co  m*/
 * This file is part of Dorado 7.x (http://dorado7.bsdn.org).
 * 
 * Copyright (c) 2002-2012 BSTEK Corp. All rights reserved.
 * 
 * This file is dual-licensed under the AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) 
 * and BSDN commercial (http://www.bsdn.org/licenses) licenses.
 * 
 * If you are unsure which license is appropriate for your use, please contact the sales department
 * at http://www.bstek.com/contact.
 */

import java.io.File;
import java.io.IOException;

public class Main {
    private static File rootDir;

    private static File getRootDir() throws IOException {
        if (rootDir == null) {
            rootDir = new File(System.getProperty("java.io.tmpdir") + File.separator + ".dorado.tmp");
            if (!rootDir.exists()) {
                if (!rootDir.mkdirs()) {
                    throw new IOException("Make directory \"" + rootDir.getAbsolutePath() + "\" failed.");
                }
            } else if (!rootDir.isDirectory()) {
                throw new IOException("\"" + rootDir.getAbsolutePath() + "\" is not a directory.");
            }
        }
        return rootDir;
    }
}

Related

  1. getRoot(File file, ArrayList lst)
  2. getRoot(final File workingDirectory)
  3. getRoot(final String path)
  4. getRoot(String path)
  5. getRootDir()
  6. getRootDir()
  7. getRootDir()
  8. getRootDir()
  9. getRootDir()