Here you can find the source of checkDir(String pDir)
public static void checkDir(String pDir) throws Exception
//package com.java2s; /******************************************************************************* * /*w w w .j a v a 2 s.co m*/ * Copyright 2007 Randall * * This file is part of gomule. * * gomule is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * gomule is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * gomlue; if not, write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************/ import java.io.*; public class Main { public static void checkDir(String pDir) throws Exception { File lDir = new File(pDir); if (!lDir.exists()) { if (!lDir.mkdirs()) { throw new Exception("Can not create backup dir: " + pDir); } } if (!lDir.isDirectory()) { throw new Exception("File exists with name of backup dir: " + pDir); } if (!lDir.canRead()) { throw new Exception("Can not read backup dir: " + pDir); } if (!lDir.canWrite()) { throw new Exception("Can not write backup dir: " + pDir); } } }