Create the destination directory if it doesn't exist.

@param  string  $destination

@return void
18735
protected function makeDestination(string $destination): void
    {
        if (! $this->files->isDirectory($destination)) {
            $this->files->makeDirectory($destination, 0777, true);
        }
    }
1298916
public function createDirectory($dirPath)
    {
      if (! $this->fs->exists($dirPath))
      {
        $this->fs->mkdir($dirPath);
      }
    }
346737
public function setLocation(string $location)
    {
        $dir = Directory::make($location, Directory::MAKE_DIRECTORY_EXISTS_OPEN);

        $old = $this->getPath();
        $new = $dir->getPath();

        if(rename($old, $new)) {
            $this->_location = $dir->getPath();
        }
    }
1332631
public function emitStructure($destination)
    {
        $this->treeGenerator->addPaths($this->getPaths());

        return $this->treeGenerator->generate($destination);
    }
489017
public function write($destination, $create = true, $html = null)
    {
        $output = $this->output($html);
        $File = new File($destination, $create);

        return $File->write($output) && $File->close();
    }
805929
public function moveFile( $source, $destination )
    {
        $result = copy( $source, $destination );

        if ( TRUE === $result )
        {
            $this->deleteFile( $source );
        }

        return $result;
    }
1309147
private function createDirectory($directory)
    {
        if (is_dir($directory)) {
            return;
        }

        if (false === @mkdir($directory, 0777, true)) {
            throw new \RuntimeException(sprintf('Could not create directory "%s".', $dir));
        }
    }
661666
public static function makeDir($dir) {
		$fs = new Filesystem();
		try {
			$fs->mkdir($dir);
		} catch (IOExceptionInterface $e) {
			Console::writeError("an error occurred while creating your directory at <path>".$e->getPath()."</path>...");
		}
		unset($fs);
	}
811822
public function setDirectory($directory)
    {
        $this->directory = $directory . DIRECTORY_SEPARATOR . $this->id;
        if (file_exists($this->directory) === false) {
            mkdir($this->directory, $this->fileMode, true);
        }
    }
732500
public function moveTo($destination)
    {
        if (!$this->ok()) {
            throw new RuntimeException('Cannot move invalid file upload');
        }
        if ($this->moved) {
            throw new RuntimeException('Uploaded file already moved');
        }
        if (!($this->move)($this->path, $destination)) {
            throw new RuntimeException('Failed moving uploaded file');
        }

        $this->path  = $destination;
        $this->moved = true;
    }
563285
protected function createDirectoryIfNotExists()
    {
        if (!is_dir($this->getPath())) {
            $this->files->makeDirectory($this->getPath(), 0755, true);
        }
    }
1278729
public function clone($destination)
    {
        $fs = new Filesystem;

        if (! $fs->exists($destination)) {
            $fs->mkdir($destination, 0755);
        }

        $fs->mirror($this->source, $destination, null, $this->options);
    }
433051
public function move( $source, $destination ) {

		if ( false === $this->copy( $source, $destination ) ) {
			return false;
		}

		$this->delete( $source );

		return true;
	}
1153059
public function linkTo($destination) {
		$target = new FileDescriptor($destination);
		$targetDir = new Directory($target->getDirname());
		$targetDir->make();

		$ok = false;
		if ($target->isLink()) {
			if (!$target->getLinkTarget()->equals($this->pathname)) {
				$target->delete();
			} else {
				$ok = true;
			}
		}

		if (!$ok && @symlink($this->pathname, $target->getPathname()) !== true) {
			$report = error_get_last();
			if (is_array($report) && DIRECTORY_SEPARATOR === '\\' && strpos($report['message'], 'error code(1314)') !== false) {
				throw new FileException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?');
			}
			throw new FileException(sprintf('Failed to create symbolic link from %s to %s', $this->pathname, $targetDir));
		}
	}
250229
private static function _set_callback($destination)
    {

        if(is_callable($destination))
        {
            self::$callback = array($destination,self::$_attr);
        }
        else
        {
            $result = explode('/', trim($destination, '/'));
            //fix the controller now
            $controller = ($result[0] == "") ? configItem('site')['default_controller'] : str_replace('-', '/', $result[0]);
            //if no method, set it to index
            $method = isset($result[1]) ? $result[1] : 'index';

            //if controller is valid file
            if (self::fileExists($file = ucfirst(configItem('site')['cust_controller_dir']) . $controller . '.php',false)) {
                self::$callback = array(ucFirst($controller), $method, self::$_attr);
            } else {
                header("HTTP/1.0 404 Not Found");
                self::$_base->hook('404',array(
                    'file' => $file,
                    'controller' => $controller,
                    'method' => $method,
                    'message' => '404'
                ));
                die();
            }
        }

    }
1249288
private function ensuredCopyDir($source, $destination)
    {
        try
        {
            $filesList = $this->getContents($source);

            foreach ($filesList as $file)
            {
                $path = $file['path'];
                $dest = explode(DIRECTORY_SEPARATOR, $path, 2);
                $dest = $destination . DIRECTORY_SEPARATOR . $dest[1];

                if ($file['type'] === Filesystem::TYPE_DIRECTORY)
                {
                    $this->copyDir($path, $dest);
                }
                else if ($file['type'] === Filesystem::TYPE_FILE)
                {
                    $this->copyFile($path, $dest);
                }
            }

            return;
        }
        catch (Error $ex)
        {}
        catch (Exception $ex)
        {}

        throw new WriteException("Directory $source could not be copied to $destination.");
    }
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.');
        }
    }