Here you can find the source of isLegalDir(final String dirname)
Parameter | Description |
---|---|
dirname | Path to a directory |
public static boolean isLegalDir(final String dirname)
//package com.java2s; /******************************************************************************* * Copyright (c) 2005, 2007 committers of openArchitectureWare and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from www .j ava2 s. c om*/ * committers of openArchitectureWare - initial API and implementation *******************************************************************************/ import java.io.File; public class Main { /** * Proves if the argument points to a existent directory (not file!). * * @param dirname * Path to a directory * @return <tt>true</tt> if the path points to a directory, <tt>false</tt> * if the directory does not exist or is a file. */ public static boolean isLegalDir(final String dirname) { final File f = new File(dirname); if (!f.exists()) { return false; } if (f.isFile()) { return false; } return true; } }