Files
init.sh/generator.php
Christer Warén 3582fc211a Generator Update
2025-12-04 04:49:57 +02:00

36 lines
742 B
PHP

<?php
$base = file_get_contents(__DIR__."/src/base.sh");
$dirs = [
__DIR__.'/src/functions/*.sh',
__DIR__.'/src/ui/*.sh'
];
$codes = [];
foreach($dirs as $dir){
foreach(glob($dir) as $file){
if(str_contains($dir, "functions")){
$codes['functions'][$file] = file_get_contents($file);
}
if(str_contains($dir, "ui")){
$codes['ui'][$file] = file_get_contents($file);
}
}
}
$code = str_replace("{{ FUNCTIONS }}", implode("\n", $codes['functions']), $base);
$code = str_replace("{{ UI }}", implode("\n", $codes['ui']), $code);
try {
$file = __DIR__.'/init.sh';
$file = fopen($file, "w");
fwrite($file, $code);
fclose($file);
} catch (\Error $e) {
}
?>