[Development] QFileSystemWatcher and Recursive Monitoring

Robert Knight robertknight at gmail.com
Fri Jul 20 11:37:10 CEST 2012


> With FSEvents you cannot emit signals such as fileChanged(), fileModified(),
> pathCreated(), or pathDeleted() if all you're notified about is that
> "something happened in this folder here",

>From my experience building an app that 'watches' a folder and imports
all files of a certain type
added there, I would prefer that QFSW was simple and reliable and
doesn't attempt
to impose a heavy cost or internal complexity (which translates into
bugs) for things
that the underlying APIs do not really support - leaving it up to the
app to decide how
best to handle these limitations.

As you say, applications which are watching (possibly large) directory
trees will likely
have their own database of content which they will compare any changes
to.  The app
can optimize this in domain-specfic ways, such as not recording any
information about
types of files it doesn't care about.

Here is the FSEvents wrapper we use on Mac for example:

https://gist.github.com/3149811

If the underlying APIs for fine-grained notifications and broad file
system watches are quite different (as is the case for Mac),
I think it makes sense not to try and 'paper over' that in the Qt
APIs, so providing different classes would be better.

> Would be easiest to implement, we could even drop all the threading currently there now.

There is a lot to be said for internal simplicity, especially where
threading is concerned.

Regards,
Rob.

On 20 July 2012 06:28, logic.cpp <logic.cpp at gmail.com> wrote:
> #1
> Clarification of original post:
>
> When I say "Making QFileSystemWatcher Recursive" I mean *adding* new functions
> for recursive monitoring, such as "addPathRecursively()". I don't mean to
> replace the current non-recursive functinality, which is very useful in its own
> right (for "A" category use cases mentioned).
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list