Create a directory if it doesn't already exist.

@param directory        the directory which definitely exists after this method call.
@param descriptionLabel to associate with the directory for any exceptions.
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);
            }
        }
    }
365833
private void createExtensionDirectory(String coordinate, File atLocation)
  {
    if (atLocation.isDirectory()) {
      log.info("Directory [%s] already exists, skipping creating a directory", atLocation.getAbsolutePath());
      return;
    }

    if (!atLocation.mkdir()) {
      throw new ISE(
          "Unable to create directory at [%s] for coordinate [%s]",
          atLocation.getAbsolutePath(),
          coordinate
      );
    }
  }
152438
public static void mkdir(File dir) throws IOException{
        if(!dir.exists() && !dir.mkdir())
            throw new IOException("couldn't create directory: "+dir);
    }
620143
public static void createDirectory(File location) throws IOException {
    if (!(location.exists() || location.mkdirs() || location.isDirectory())) {
      throw new IOException("Could not create directory at " + location);
    }
  }
1205062
public void setSourceDirectory (final File directory)
  {
    if (!directory.isAbsolute ())
    {
      throw new IllegalArgumentException ("source directory is not absolute: " + directory);
    }
    this.scanner.setBasedir (directory);
  }
1092244
public static void createDirectory(Path dir, String dirDesc)
    {
        try
        {
            Files.createDirectories(dir);
        }
        catch (IOException ex)
        {
            throw new WindupException("Error creating " + dirDesc + " folder: " + dir.toString() + " due to: " + ex.getMessage(), ex);
        }
    }
542359
public void setCompileDirectory(String directory) {
        if (directory != null && directory.trim().length() > 0) {
            File file = new File(directory);
            if (file.exists() || file.mkdirs()) {
                this.compileDirectory = file;
            }
        }
    }
1370065
private static void createDirectory(final File directory) throws MojoExecutionException
  {

    try {
      com.sap.prd.mobile.ios.mios.FileUtils.deleteDirectory(directory);
    }
    catch (IOException ex) {
      throw new MojoExecutionException("", ex);
    }

    if (!directory.mkdirs())
      throw new MojoExecutionException("Cannot create directory (" + directory + ")");
  }
238374
public static void createDirectory( File directory ) throws IOException {

		if( ! directory.exists()
				&& ! directory.mkdirs())
			throw new IOException( "The directory " + directory + " could not be created." );
	}
591468
@Override
    protected void initializeStorage( File directory ) throws BinaryStoreException {
        // make sure the directory doesn't exist
        FileUtil.delete(directory);
        if (!directory.exists()) {
            logger.debug("Creating temporary directory for transient binary store: {0}", directory.getAbsolutePath());
            directory.mkdirs();
        }
        if (!directory.canRead()) {
            throw new BinaryStoreException(JcrI18n.unableToReadTemporaryDirectory.text(directory.getAbsolutePath(),
                                                                                       JAVA_IO_TMPDIR));
        }
        if (!directory.canWrite()) {
            throw new BinaryStoreException(JcrI18n.unableToWriteTemporaryDirectory.text(directory.getAbsolutePath(),
                                                                                        JAVA_IO_TMPDIR));
        }
    }
737197
public void makeDir(String dir, String data) {

        try {

            boolean deafult_path_exist = store.exists(dir);
            if (!deafult_path_exist) {
                LOGGER.info("create: " + dir);
                this.writePersistentUrl(dir, data);
            } else {
            }

        } catch (KeeperException e) {

            LOGGER.error("cannot create path: " + dir, e);

        } catch (Exception e) {

            LOGGER.error("cannot create path: " + dir, e);
        }
    }
955134
protected function ensureDirectory(string $directory): void
    {
        if (!is_dir($directory)) {
            $success = @mkdir($directory, 0775, true);
            if (!$success && !is_dir($directory)) {
                throw new ExportDataException('Unable to create directory ' . $directory . '.');
            }
        }

        if (!is_writable($directory)) {
            throw new ExportDataException('Directory ' . $directory . ' is not writable.');
        }
    }
1368369
public function setDataDirectory(string $directory)
    {
        if (!is_dir($directory)) {
            $exception = new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $directory));
            $exception->setDirectory($exception);
            $exception->setProvider(static::class);
            throw $exception;
        }

        $this->dataDirectory = $directory;
    }
723915
public void create(Path destDir) {
        Path sampledir = getSampleDir(destDir);
        if (!sampledir.toFile().exists()) {
            sampledir.toFile().mkdirs();
        }
        sampleManager.unarchiveBasicSample(destDir.toString());
    }
310865
@Override
    public void setDescription(final String description) {
        if (this.description == null) {
            this.description = new SyndContentImpl();
        }
        this.description.setValue(description);
    }
152255
public void addDirectory(File dir) {
    File[] ndirs = new File[directories.length + 1];
    System.arraycopy(directories, 0, ndirs, 0, directories.length);
    ndirs[ndirs.length - 1] = dir;
    directories = ndirs;
  }
272716
public final void removeDirectory(final File directory) {
        try {
            FileUtils.deleteDirectory(directory);
        } catch (IOException e) {
            LOGGER.error("Unable to delete directory '{}'", directory);
        }
    }