public function fire(array $args = []) : bool
{
try {
$this->getSession();
$dir = $this->session['dir'] . $this->findRelativeDir();
} catch (\Error $e) {
echo $e->getMessage(), "\n";
return false;
}
if (\count($args) === 0) {
echo 'No file passed.', "\n";
return false;
}
if (!\array_key_exists('autoRun', $this->session)) {
// echo 'Creating session data', "\n";
$this->session['autoRun'] = [];
}
$added = 0;
foreach ($args as $file) {
$l = \strlen($file) - 1;
if ($file[$l] === DIRECTORY_SEPARATOR) {
$file = substr($file, 0, -1);
}
$added += $this->addautoRun($file, $dir);
}
echo $added, ' autoRun script', $added === 1 ? '' : 's', ' registered.', "\n";
return true;
}