Rename to suggestions

This commit is contained in:
crazywhalecc
2025-07-23 15:33:26 +08:00
parent 45f257ef14
commit b0c0ecb59c
3 changed files with 12 additions and 12 deletions

View File

@@ -317,26 +317,26 @@ abstract class LibraryBase
protected function install(): void
{
// replace placeholders if BUILD_ROOT_PATH/.spc-extract-placeholder.json exists
$placeholder_file = BUILD_ROOT_PATH . '/.spc-extract-placeholder.json';
if (!file_exists($placeholder_file)) {
$replace_item_file = BUILD_ROOT_PATH . '/.spc-extract-placeholder.json';
if (!file_exists($replace_item_file)) {
return;
}
$placeholders = json_decode(file_get_contents($placeholder_file), true);
if (!is_array($placeholders)) {
throw new RuntimeException('Invalid placeholder file: ' . $placeholder_file);
$replace_items = json_decode(file_get_contents($replace_item_file), true);
if (!is_array($replace_items)) {
throw new RuntimeException('Invalid placeholder file: ' . $replace_item_file);
}
$placeholder_mark = get_pack_placehoder();
$placeholders = get_pack_replace();
// replace placeholders in BUILD_ROOT_PATH
foreach ($placeholders as $item) {
foreach ($replace_items as $item) {
$filepath = BUILD_ROOT_PATH . "/{$item}";
FileSystem::replaceFileStr(
$filepath,
array_values($placeholder_mark),
array_keys($placeholder_mark),
array_values($placeholders),
array_keys($placeholders),
);
}
// remove placeholder file
unlink($placeholder_file);
unlink($replace_item_file);
}
/**