Skip to content

Conversation

@AlmostEasyGoing
Copy link

@AlmostEasyGoing AlmostEasyGoing commented Dec 31, 2025

Overview

An implementation idea for part of #149 (ignoring certain files/directories, see this comment).
The idea is to allow for an exclusion regex for file and directory names (separately, for flexibility) in the configuration.
This would allow e.g. for setting the regex for directories to ^\.ignore$ and then you could just move all of your ignorable files/directories containing archives there.
Since it's a global setting it also works for subdirectories, so e.g. a structure like this:

files
├── Game A
│   ├── Game A (v1.0) (2025).zip
│   └── .ignore
│       ├── other_stuff.zip
│       └── patch.zip
├── Game B
│   └── ...
└── Game C
    └── ...

For the future, this could be combined as an enhancement to file organization with the original idea of #149, where file name constraints for files enhancing the game archive ('Extras') are suggested.

Reasoning

The indexer picking up any and all archives seems a bit too broad. While this automatically excludes e.g. images, videos, text files and the like, it does not exclude any archives. For games, aside from the aforementioned file types, you may additionally store game patches as archives to conserve space (and to have the patch in once place, as it may not be consisting of one file only).
There is currently no clear option to exclude archives from being picked up.

Implementation Details

New (optional) string environment variables:

  • GAMES_SEARCH_EXCLUDE_DIR_REGEX
  • GAMES_SEARCH_EXCLUDE_FILE_REGEX

Since fs.readdir() does not have an exclusion setting, it became necessary to write a recursive walk function.
I don't really know how this will behave for large libraries though, especially since during the walk a lot of Promises could spawn and try to resolve all at once. There is likely a more efficient implementation.

Update (2026-01-03): I see that this commit in the develop branch reimplements the readAllFiles method using readdirp, which actually does support this usecase. Therefore you should be able to simply set the fileFilter and directoryFilter arguments to a regex test of the file/dir name with GAMES_SEARCH_EXCLUDE_FILE_REGEX and GAMES_SEARCH_EXCLUDE_DIR_REGEX accordingly.

@AlmostEasyGoing AlmostEasyGoing marked this pull request as draft January 3, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant