init.sh/generator.php

30 lines
566 B
PHP
Raw Normal View History

2024-05-01 00:22:32 +00:00
<?php
$base = file_get_contents(__DIR__."/src/base.sh");
$dirs = [
__DIR__.'/src/functions/*.sh'
];
$codes = [];
foreach($dirs as $dir){
foreach(glob($dir) as $file){
$codes[$file] = file_get_contents($file);
}
}
$code = str_replace("{{ CODES }}", implode("\n", $codes), $base);
2024-06-01 12:07:30 +00:00
$code = str_replace("{{ COMPATIBILITY }}", implode("\n", file_get_contents(__DIR__.'/src/compatibility.sh')), $base);
2024-05-01 00:22:32 +00:00
try {
$file = __DIR__.'/init.sh';
$file = fopen($file, "w");
fwrite($file, $code);
fclose($file);
} catch (\Error $e) {
}
?>