A private utility function to verify that the directory is really a
directory, exists, and absolute.

@param dirs
directory to check
@param dtype
name to use in case of errors
485310
private void checkDirectory(File d, String dtype) {

        if (!d.isAbsolute()) {
            throw new IllegalArgumentException(dtype
                    + " directory must be an absolute path (" + d.getPath() + ")");
        }
        if (!d.exists()) {
            throw new IllegalArgumentException(dtype
                    + " directory does not exist (" + d.getPath() + ")");
        }
        if (!d.isDirectory()) {
            throw new IllegalArgumentException(dtype
                    + " directory value is not a directory (" + d.getPath() + ")");
        }

    }
872786
def is_dir(path):
    """"""
    try:
        return path.expanduser().absolute().is_dir()
    except AttributeError:
        return os.path.isdir(os.path.abspath(os.path.expanduser(str(path))))
1096817
function exists(path, type) {
	try {
		switch (type){
			case "d": return FS.statSync(path).isDirectory();
			default:  return FS.statSync(path).isFile();
		}
	}
	catch (err) {
		return false;
	}
}
144185
function containsPath(self, dirname) {
  return self.__paths__.some(function(p) {
    return p === dirname.substr(0, p.length);
  });
}
943495
async function exists(dir) {
  try {
    debug(`checking if ${dir} exists`);
    const s = await stat(dir);

    debug(`${dir} exists`);

    return s.isDirectory();
  }
  catch (err) {
    debug(`${dir} does not exist`);

    return false;
  }
}
1064959
def _ensure_directory_exists(self, directory):
        """"""
        if not os.path.lexists(directory):
            os.makedirs(directory)
        return directory
243806
def ensure_path_exists(dir_path):
    
    if not os.path.exists(dir_path):
        mkdir(dir_path)
        return True
    return False
298314
def ensure_directory_exists(directory):
  '''
  '''
  if not os.path.exists(directory):
    os.makedirs(directory)
  elif os.path.isfile(directory):
    raise RuntimeError('Path %s is a file, not a directory.' % directory)
11178
def directory_exists(self, directory):
        """"""
        file_list = []
        self.session.retrlines('LIST', file_list.append)
        return any(f.split()[-1] == directory and f.upper().startswith('D') for f in file_list)
303873
boolean isDir(String src) {
    byte[][] components = INodeDirectory.getPathComponents(normalizePath(src));
    readLock();
    try {
      INode node = rootDir.getNode(components);
      return isDir(node);
    } finally {
      readUnlock();
    }
  }
204054
function contains(dirs, p) {
    if (!Array.isArray(dirs)) dirs = [dirs];
    return dirs.some(dir => {
      return indir(dir, p);
    });
  }
8311
def ensure_directory(path):
    
    dirname = os.path.dirname(path)
    if not os.path.exists(dirname):
        os.makedirs(dirname)
1203594
def dir_type(arg):
	""""""
	if not os.path.isdir(arg):
		raise argparse.ArgumentTypeError("{0} is not a valid directory".format(repr(arg)))
	return arg
535084
def ensure_dirs(filename):
    """"""
    dirname = os.path.dirname(filename)
    if dirname and not os.path.exists(dirname):
        os.makedirs(dirname)
1295882
def isdir(path, **kwargs):
    """"""
    import os.path
    return os.path.isdir(path, **kwargs)
755148
private void verifyParentDir(String src) throws FileAlreadyExistsException,
      FileNotFoundException {
    Path parent = new Path(src).getParent();
    if (parent != null) {
      INode[] pathINodes = dir.getExistingPathINodes(parent.toString());
      if (pathINodes[pathINodes.length - 1] == null) {
        throw new FileNotFoundException("Parent directory doesn't exist: "
            + parent.toString());
      } else if (!pathINodes[pathINodes.length - 1].isDirectory()) {
        throw new FileAlreadyExistsException("Parent path is not a directory: "
            + parent.toString());
      }
    }
  }
1168387
def is_directory(self, path):
        """"""
        return self._getReturnCodeCmd([self._hadoop_cmd, 'fs', '-test', '-d', self._full_hdfs_path(path)]) == 0