From b0c0ecb59c22034ac36aa9d8bccf02c0ce9760d1 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 23 Jul 2025 15:33:26 +0800 Subject: [PATCH] Rename to suggestions --- src/SPC/builder/LibraryBase.php | 20 ++++++++++---------- src/SPC/command/dev/PackLibCommand.php | 2 +- src/globals/functions.php | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/SPC/builder/LibraryBase.php b/src/SPC/builder/LibraryBase.php index a8bb3ed0..5f03d72c 100644 --- a/src/SPC/builder/LibraryBase.php +++ b/src/SPC/builder/LibraryBase.php @@ -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); } /** diff --git a/src/SPC/command/dev/PackLibCommand.php b/src/SPC/command/dev/PackLibCommand.php index 7b6aec07..366ef71e 100644 --- a/src/SPC/command/dev/PackLibCommand.php +++ b/src/SPC/command/dev/PackLibCommand.php @@ -53,7 +53,7 @@ class PackLibCommand extends BuildCommand $origin_files = []; // get pack placehoder defines - $placehoder = get_pack_placehoder(); + $placehoder = get_pack_replace(); foreach ($builder->getLibs() as $lib) { if ($lib->getName() !== $lib_name) { diff --git a/src/globals/functions.php b/src/globals/functions.php index 28f059ac..b45d8c5e 100644 --- a/src/globals/functions.php +++ b/src/globals/functions.php @@ -233,7 +233,7 @@ function ac_with_args(string $arg_name, bool $use_value = false): array return $use_value ? ["--with-{$arg_name}=yes", "--with-{$arg_name}=no"] : ["--with-{$arg_name}", "--without-{$arg_name}"]; } -function get_pack_placehoder(): array +function get_pack_replace(): array { return [ BUILD_LIB_PATH => '@build_lib_path@',