This commit is contained in:
crazywhalecc 2025-12-04 10:54:05 +08:00
parent daa87e1350
commit 71d803d36f
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 16 additions and 16 deletions

View File

@ -493,7 +493,7 @@ class Artifact
* Emit all after binary extract callbacks for the specified platform.
*
* @param null|string $target_path The directory where binary was extracted
* @param string $platform The platform string (e.g., 'linux-x86_64')
* @param string $platform The platform string (e.g., 'linux-x86_64')
*/
public function emitAfterBinaryExtract(?string $target_path, string $platform): void
{

View File

@ -570,6 +570,21 @@ class ArtifactExtractor
FileSystem::removeDir($temp_dir);
}
/**
* Replace path variables.
*/
protected function replacePathVariables(string $path): string
{
$replacement = [
'{pkg_root_path}' => PKG_ROOT_PATH,
'{build_root_path}' => BUILD_ROOT_PATH,
'{source_path}' => SOURCE_PATH,
'{download_path}' => DOWNLOAD_PATH,
'{working_dir}' => WORKING_DIR,
];
return str_replace(array_keys($replacement), array_values($replacement), $path);
}
/**
* Move file or directory, handling cross-device scenarios
* Uses rename() if possible, falls back to copy+delete for cross-device moves
@ -608,21 +623,6 @@ class ArtifactExtractor
}
}
/**
* Replace path variables.
*/
protected function replacePathVariables(string $path): string
{
$replacement = [
'{pkg_root_path}' => PKG_ROOT_PATH,
'{build_root_path}' => BUILD_ROOT_PATH,
'{source_path}' => SOURCE_PATH,
'{download_path}' => DOWNLOAD_PATH,
'{working_dir}' => WORKING_DIR,
];
return str_replace(array_keys($replacement), array_values($replacement), $path);
}
private function copyFile(string $source_file, string $target_path): void
{
FileSystem::createDir(dirname($target_path));