private function safeCopy($fullSourcePath, $fullTargetPath, $relativeWebDir = '')
    {
        if (file_exists($fullTargetPath)) {
            if (!is_file($fullTargetPath)) {
                // Seems to be a directory: ignore
                return false;
            }
            if (!self::isTypo3CmsBinary($fullTargetPath)) {
                // File is there but does not seem to be a previous version of our script: better ignore
                return false;
            }
        }
        if ($this->isWindowsOs()) {
            $success = @copy($fullSourcePath, $fullTargetPath);
        } else {
            $proxyFileContent = file_get_contents($fullSourcePath);
            $proxyFileContent = str_replace(
                'require __DIR__ . \'/Scripts/typo3-console.php\';',
                '// In non Composer mode we\'re copied into TYPO3 web root
require __DIR__ . \'/typo3conf/ext/typo3_console/Scripts/typo3-console.php\';',
                $proxyFileContent
            );
            $success = file_put_contents($fullTargetPath, $proxyFileContent);
        }

        if ($success && !$this->isWindowsOs()) {
            $success = @chmod($fullTargetPath, 0755);
        }
        if ($success) {
            $success = @file_put_contents(
                $fullTargetPath,
                str_replace(
                    '{$relative-web-dir}',
                    $relativeWebDir,
                    file_get_contents($fullTargetPath)
                )
            );
        }

        return $success;
    }