robot-loader icon indicating copy to clipboard operation
robot-loader copied to clipboard

ExcludeFiles [READY CODE]

Open Pok4 opened this issue 2 years ago • 3 comments

Ok, i find a way to fix my things in https://github.com/nette/robot-loader/discussions/31 Sorry for my english is not good at all...

Ok, open RobotLoader.php and find: private array $excludeDirs = []; after this line add: private array $excludeFiles = [];

find:

public function excludeDirectory(string ...$paths): static
{
	$this->excludeDirs = array_merge($this->excludeDirs, $paths);
	return $this;
}

after this add:

public function excludeFiles($files)
{
	$this->excludeFiles = $files;
	return $this;
}

find: exclude($this->ignoreDirs); make it like this: exclude($this->ignoreDirs)->exclude($this->excludeFiles);

After that you can use: $loader->excludeFiles(['sql.php','en.php','es.php','bg.php','fr.php','ru.php','migrate.php']);

excludeDirs is working normal with this addon (i tested it). Can you commit the changes ? :)

Pok4 avatar Nov 07 '23 18:11 Pok4

We are in the end of 2024 and i'm still using the autoloader in my includes/ folder of my cms with this modifications above. Can you add in next version something like that to exclude specific file names? I want to delete this file and update the library from github with modifications..

Pok4 avatar Dec 03 '24 18:12 Pok4

There is a standalone version of robot-loader, you can use and modify for your project.

https://github.com/nette/robot-loader/issues/22

eydun avatar Dec 04 '24 10:12 eydun

yes, but i'm not prefer this version, because i'm using nette email library and other stuff, that depends on other nette libraries, so i need modifications on main version...

Pok4 avatar Dec 04 '24 11:12 Pok4