src/PHPDish/Bundle/CoreBundle/Installer/Checker/DirectoryChecker.php
public function ensureExists($directory)
    {
        if (is_dir($directory)) {
            return;
        }

        try {
            $this->filesystem->mkdir($directory, 0755);

            $this->output->writeln(sprintf('<comment>Created "%s" directory.</comment>', realpath($directory)));
        } catch (IOException $exception) {
            $this->output->writeln('');
            $this->output->writeln('<error>Cannot run command due to unexisting directory (tried to create it automatically, failed).</error>');
            $this->output->writeln('');

            throw new \RuntimeException(sprintf(
                'Create directory "%s" and run command "<comment>%s</comment>"',
                realpath($directory),
                $this->name
            ));
        }
    }
public function ensureExists($directory)
    {
        if (is_dir($directory)) {
            return;
        }

        try {
            $this->filesystem->mkdir($directory, 0755);

            $this->output->writeln(sprintf('<comment>Created "%s" directory.</comment>', realpath($directory)));
        } catch (IOException $exception) {
            $this->output->writeln('');
            $this->output->writeln('<error>Cannot run command due to unexisting directory (tried to create it automatically, failed).</error>');
            $this->output->writeln('');

            throw new \RuntimeException(sprintf(
                'Create directory "%s" and run command "<comment>%s</comment>"',
                realpath($directory),
                $this->name
            ));
        }
    }
检查目录是否存在.

@param string $directory