Skip to content

Directory watcher trigger events no matter the file filter given #24

@Meach

Description

@Meach

Hi,

It seems that the directory watcher doesn't take care of the path filter we give him when adding a path.

If I make a custom path filter where I only want to see "wav" files for example:

class WavPathFilter : public ofxIO::AbstractPathFilter
{
public:
	WavPathFilter() {}
	virtual ~WavPathFilter() {}

	bool accept(const Poco::Path& path) const
	{
		// Return only .wav file
		return path.getExtension() == "wav";
	}
};

And use this filter to add a path to my directory watcher

ofxIO::DirectoryWatcherManager watcher;
WavPathFilter wavFilter;

watcher.addPath(folder_to_watch, false, false, &wavFilter);

Then no matter which type file is modified inside the folder to watch, the directory watcher will trigger events. I noticed the same behavior in the example project as well (with hidden files).

Though if I use the same filter to list the folder directory, then it works: I only get "wav" files listed in my vector.

vector<string> myFiles;
ofxIO::DirectoryUtils::list(folder_to_watch, myFiles, true, &wavFilter);

How can I have the directory watcher filter out the files I am not interested in directly?

I am on stable branch.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions