Skip to content

Commit

Permalink
add func cleanFile
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjingxyk committed May 20, 2024
1 parent 325443f commit 818cc57
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
19 changes: 10 additions & 9 deletions prepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
$p->parseArguments($argc, $argv);


# clean
# clean old make.sh
if (file_exists(__DIR__ . '/make.sh')) {
unlink(__DIR__ . '/make.sh');
unlink(__DIR__ . '/make-install-deps.sh');
unlink(__DIR__ . '/make-env.sh');
unlink(__DIR__ . '/make-export-variables.sh');
}
$p->cleanFile(__DIR__ . '/make.sh');
$p->cleanFile(__DIR__ . '/make-install-deps.sh');
$p->cleanFile(__DIR__ . '/make-env.sh');
$p->cleanFile(__DIR__ . '/make-export-variables.sh');
$p->cleanFile(__DIR__ . '/make-download-box.sh');
$p->cleanFile(__DIR__ . '/cppflags.log');
$p->cleanFile(__DIR__ . '/ldflags.log');
$p->cleanFile(__DIR__ . '/libs.log');
$p->cleanFile(__DIR__ . '/configure.backup');

if (file_exists(__DIR__ . '/make-download-box.sh')) {
unlink(__DIR__ . '/make-download-box.sh');
}

// Sync code from php-src
$p->setPhpSrcDir($homeDir . '/.phpbrew/build/php-' . BUILD_PHP_VERSION);
Expand Down
9 changes: 9 additions & 0 deletions sapi/src/Preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1223,4 +1223,13 @@ public function hasExtension(string $ext): bool
{
return isset($this->extensionMap[$ext]);
}

public function cleanFile(string $file): bool
{
if (is_file($file)) {
unlink($file);
return true;
}
return false;
}
}

0 comments on commit 818cc57

Please sign in to comment.