Ensures that a directory is available

@param path  Path to directory
@param mode  Mode for the newly created directory
@return      The {@link LocalCall} object to make the call
498925
public static LocalCall<String> mkdir(String path, String mode) {
        return mkdir(path, Optional.empty(), Optional.empty(), Optional.of(mode));
    }
361398
@VisibleForTesting
  static File getFile(String[] localDirs, int subDirsPerLocalDir, String filename) {
    int hash = JavaUtils.nonNegativeHash(filename);
    String localDir = localDirs[hash % localDirs.length];
    int subDirId = (hash / localDirs.length) % subDirsPerLocalDir;
    return new File(createNormalizedInternedPathname(
        localDir, String.format("%02x", subDirId), filename));
  }
1245157
def ensure_dir(self, mode=0777):
        
        if not self.exists() or not self.isdir():
            os.makedirs(self, mode)
536519
protected String getLocalePath (String path)
    {
        return (_localeHandler == null) ? null : _localeHandler.getLocalePath(path);
    }
114334
public static function mkdir($path, $mode = 0755)
    {
        $filesystem = new Filesystem();

        try {
            $filesystem->mkdir($path, $mode);
        } catch (IOException $exception) {
            return false;
        }

        return true;
    }
786507
@Override
    public T addAsDirectory(final String path) throws IllegalArgumentException {
        // Precondition check
        Validate.notNullOrEmpty(path, "path must be specified");

        // Delegate and return
        return this.addAsDirectory(ArchivePaths.create(path));
    }
1352118
@Requires("location != null")
  public void setLocation(Location location, List<? extends File> path)
      throws IOException {
    fileManager.setLocation(location, path);
  }
667999
private void checkDeletable(File file, DeleteMode mode, Path path) throws IOException {
    if (file.isRootDirectory()) {
      throw new FileSystemException(path.toString(), null, "can't delete root directory");
    }

    if (file.isDirectory()) {
      if (mode == DeleteMode.NON_DIRECTORY_ONLY) {
        throw new FileSystemException(path.toString(), null, "can't delete: is a directory");
      }

      checkEmpty(((Directory) file), path);
    } else if (mode == DeleteMode.DIRECTORY_ONLY) {
      throw new FileSystemException(path.toString(), null, "can't delete: is not a directory");
    }

    if (file == workingDirectory && !path.isAbsolute()) {
      // this is weird, but on Unix at least, the file system seems to be happy to delete the
      // working directory if you give the absolute path to it but fail if you use a relative path
      // that resolves to the working directory (e.g. "" or ".")
      throw new FileSystemException(path.toString(), null, "invalid argument");
    }
  }
17416
function localRequire(path) {
    var resolved = localRequire.resolve(path);
    return require(resolved, parent, path);
  }
509345
public boolean isVisited(final URI path) {
        final URI localPath = stripFragment(path).normalize();
        return visitSet.contains(localPath);
    }
491633
@Override
    public T addAsDirectory(String path) throws IllegalArgumentException {
        this.getArchive().addAsDirectory(path);
        return covarientReturn();
    }
396601
def make_directory_if_needed(directory_path):
    
    if os.path.exists(directory_path):
        if not os.path.isdir(directory_path):
            raise OSError("Path is not a directory:", directory_path)
    else:
        os.makedirs(directory_path)
1355434
public static boolean isFolderExist(String directoryPath) {
        if (StringUtils.isEmpty(directoryPath)) {
            return false;
        }

        File dire = new File(directoryPath);
        return (dire.exists() && dire.isDirectory());
    }
773345
public static void ensureDirectoryExists(final File directory, final String descriptionLabel)
    {
        if (!directory.exists())
        {
            if (!directory.mkdirs())
            {
                throw new IllegalArgumentException("could not create " + descriptionLabel + " directory: " + directory);
            }
        }
    }
720485
private static void createDirectory(Path path) throws IOException {
		try {
			Files.createDirectory(path);
		} catch (FileAlreadyExistsException e) {
			if (!Files.isDirectory(path)) {
				throw e;
			}
		}
	}
319080
public static LocalCall<String> getHash(String path) {
        return getHash(path, Optional.empty(), Optional.empty());
    }
8311
def ensure_directory(path):
    
    dirname = os.path.dirname(path)
    if not os.path.exists(dirname):
        os.makedirs(dirname)