Here you can find the source of createDirectory(Path parent, String name)
Parameter | Description |
---|---|
parent | a parameter |
name | a parameter |
public static Path createDirectory(Path parent, String name)
//package com.java2s; /*//from ww w. j a v a 2 s. c o m * EXELIXI * * Copyright (C) 2017 EPFL SCI-STI-MM * * This file is part of EXELIXI. * * EXELIXI 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 3 of the License, or * (at your option) any later version. * * EXELIXI 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 EXELIXI. If not, see <http://www.gnu.org/licenses/>. * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or combining it * with Eclipse (or a modified version of Eclipse or an Eclipse plugin or * an Eclipse library), containing parts covered by the terms of the * Eclipse Public License (EPL), the licensors of this Program grant you * additional permission to convey the resulting work. Corresponding Source * for a non-source form of such a combination shall include the source code * for the parts of Eclipse libraries used as well as that of the covered work. * */ import java.io.File; import java.nio.file.Path; public class Main { /** * Create a directory (recursively) * * @param parent * @param name * @return */ public static Path createDirectory(Path parent, String name) { Path path = null; try { File directory = new File(parent.toFile(), name); if (!directory.exists()) { if (directory.mkdirs()) { path = directory.toPath(); } } else if (directory.isDirectory()) { path = directory.toPath(); } } catch (Exception e) { e.printStackTrace(); } return path; } }