fix SourcePatcher::patchFile not working with spc binary

This commit is contained in:
crazywhalecc 2023-12-16 18:49:38 +08:00
parent ed8b606761
commit ea64e50ce5
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680

View File

@ -134,6 +134,12 @@ class SourcePatcher
$patch_file = ROOT_DIR . "/src/globals/patch/{$patch_name}";
$patch_str = str_replace('/', DIRECTORY_SEPARATOR, $patch_file);
// copy patch from phar
if (\Phar::running() !== '') {
file_put_contents(SOURCE_PATH . '/' . $patch_name, file_get_contents($patch_file));
$patch_str = str_replace('/', DIRECTORY_SEPARATOR, SOURCE_PATH . '/' . $patch_name);
}
f_passthru(
'cd ' . $cwd . ' && ' .
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patch_str . ' | patch -p1 ' . ($reverse ? '-R' : '')