Platformsh\Cli\Local\LocalProject::ensureLocalDir PHP Method

ensureLocalDir() public method

public ensureLocalDir ( string $projectRoot )
$projectRoot string
    public function ensureLocalDir($projectRoot)
    {
        $localDirRelative = $this->config->get('local.local_dir');
        $dir = $projectRoot . '/' . $localDirRelative;
        if (!is_dir($dir)) {
            mkdir($dir, 0755, true);
        }
        $this->writeGitExclude($projectRoot);
        if (!file_exists($dir . '/.gitignore')) {
            file_put_contents($dir . '/.gitignore', '/' . PHP_EOL);
        }
        if (!file_exists($dir . '/README.txt')) {
            $cliName = $this->config->get('application.name');
            file_put_contents($dir . '/README.txt', <<<EOF
{$localDirRelative}
===============

This directory is where the {$cliName} stores configuration files, builds, and
other data to help work with your project locally.

It is not used on remote environments at all - the directory is excluded from
your Git repository (via .git/info/exclude).

EOF
);
        }
    }