Java Path Create nio createFolder(String workspacePath)

Here you can find the source of createFolder(String workspacePath)

Description

create Folder

License

Apache License

Declaration

public static boolean createFolder(String workspacePath) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
    public static boolean createFolder(String workspacePath) {
        File folder = new File(workspacePath);
        if (!folder.exists()) {
            return folder.mkdirs();
        }/*from   w  ww.  ja v a 2  s.  co  m*/
        return true;
    }

    public static boolean exists(String repositoryName) {
        if (repositoryName == null || "".equals(repositoryName)) {
            return false;
        }
        Path path;
        try {
            path = FileSystems.getDefault().getPath(repositoryName);
        } catch (java.nio.file.InvalidPathException e) {
            return false;
        }
        return Files.exists(path);
    }
}

Related

  1. createFileFromText(String sourceText, IPath path)
  2. createFileIfNotExist(Path path)
  3. createFileIfNotExists(Path path)
  4. createFileRelativeToClasspath(String resourceName)
  5. createFileWithContents(String pathString, String contents)
  6. createFoldersIfNecessary(String workspacePath)
  7. createFullURI(String val, Path parent)
  8. createGlobMatcher(final Path path)
  9. createHeader(Path newFile)