components/BaseController.php
protected function normalizeTargetDir($target)
    {
        $target = rtrim(Yii::getAlias($target), '\\/');
        if (file_exists($target)) {
            if (is_dir($target) && !$this->confirm('TargetDirectory already exists. Overwrite?', true)) {
                $this->stderr('User aborted.' . PHP_EOL);

                return false;
            }
            if (is_file($target)) {
                $this->stderr("Error: Target directory \"$target\" is a file!" . PHP_EOL);

                return false;
            }
        } else {
            mkdir($target, 0777, true);
        }

        return $target;
    }
protected function normalizeTargetDir($target)
    {
        $target = rtrim(Yii::getAlias($target), '\\/');
        if (file_exists($target)) {
            if (is_dir($target) && !$this->confirm('TargetDirectory already exists. Overwrite?', true)) {
                $this->stderr('User aborted.' . PHP_EOL);

                return false;
            }
            if (is_file($target)) {
                $this->stderr("Error: Target directory \"$target\" is a file!" . PHP_EOL);

                return false;
            }
        } else {
            mkdir($target, 0777, true);
        }

        return $target;
    }
protected function normalizeTargetDir ( $ target ) { $ target = rtrim ( Yii :: getAlias ( $ target ) , '\\/' ) ; if ( file_exists ( $ target ) ) { if ( is_dir ( $ target ) && ! $ this -> confirm ( 'TargetDirectory already exists. Overwrite?' , true ) ) { $ this -> stderr ( 'User aborted.' . PHP_EOL ) ; return false ; } if ( is_file ( $ target ) ) { $ this -> stderr ( "Error: Target directory \"$target\" is a file!" . PHP_EOL ) ; return false ; } } else { mkdir ( $ target , 0777 , true ) ; } return $ target ; }
Checks that target directory is valid. Asks questions in tricky cases.
@param string $target
@return bool|string
Checks that target directory is valid . Asks questions in tricky cases .