开始通过git升级版本

This commit is contained in:
2023-09-19 16:29:19 +08:00
parent 37bbd99861
commit fcaa78f6e9
8 changed files with 196 additions and 6 deletions

View File

@@ -53,6 +53,30 @@ class PathTools
return $file_path;
}
public static function removeDir($dir_name)
{
if (!is_dir($dir_name)) {
return false;
}
if (strpos(strtolower(PHP_OS), 'win') === 0) {
$dir_name = static::formatWinPath($dir_name);
exec("rd /s /q {$dir_name}", $output);
return;
}
$handle = opendir($dir_name);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
is_dir("$dir_name/$file") ? self::removeDir("$dir_name/$file") : unlink("$dir_name/$file");
}
}
closedir($handle);
return rmdir($dir_name);
}
public static function mapDir($dir, $callback = null)
{
$result = [];
@@ -74,4 +98,9 @@ class PathTools
return $result;
}
public static function formatWinPath($content)
{
return str_replace('/', '\\', $content);
}
}