[Interest] QFileSystemWatcher malfunctioning

Jason H scorp1us at yahoo.com
Thu Jan 12 15:14:25 CET 2012


No. It is just an abstraction of your operating system's file system notification code. AFAIK, none of these native APIs support "do not notify for process X".



________________________________
 From: Sujan Dasmahapatra <sdh at lmwindpower.com>
To: interest at qt-project.org 
Sent: Thursday, January 12, 2012 7:26 AM
Subject: Re: [Interest] QFileSystemWatcher malfunctioning
 
QFileSystemWatcher intends to give signal if the file is modified outside of the application right ??? Let me know if I am wrong. But I am modified the file from within the application then why it should emit the signal. ????

Kind regards,


Sujan Dasmahapatra
Project Leader, Aero Group
CE - Aero Group

Tel  +91 80 66470248
Mob  
sdh at lmwindpower.com


LM Wind Power Blades
lmwindpower.com

Together we capture the wind to power a cleaner world


This e-mail and any attachments are confidential. If you are not the named or intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Any unauthorized disclosure, use or storage is prohibited and might be unlawful.
-----Original Message-----
From: interest-bounces+sdh=lmwindpower.com at qt-project.org [mailto:interest-bounces+sdh=lmwindpower.com at qt-project.org] On Behalf Of Andreas Pakulat
Sent: Thursday, January 12, 2012 3:39 PM
To: interest at qt-project.org
Subject: Re: [Interest] QFileSystemWatcher malfunctioning

On 12.01.12 09:14:33, Bo Thorsen wrote:
> Den 12-01-2012 08:35, Andreas Pakulat skrev:
> > On 12.01.12 08:01:17, Sujan Dasmahapatra wrote:
> >> Dear Friends
> >>
> >> I am using QFileSystemWatcher for knowing when the file is modified from
> >> outside my application. I am seeing even if the file is modified from
> >> the application this is giving message that the file is modified. Can
> >> anyone tell whats going wrong in this..see the snippet below
> >
> > There is nothing going wrong here, thats how QFileSystemWatcher is
> > intended to work. If you don't want to be notified for changes you're
> > doing yourself you need to add code for that in your application.
> 
> And this is of course the task for a SignalBlocker. I've done exactly 
> this (block QFileSystemWatcher) for a customer a couple of months ago, 
> and it really is the only solution.

That only works as long as the detection of changes happens immediately,
that might not be the case all the time since it depends on which
backend QFSWatcher uses (there's a polling one). Usually I add a
modification-timestamp check to the system, i.e. store the
modification-time right after modifying the file and then compare when
the QFSWatcher triggers. This is of course not a 100% safe solution
(hashing the file would be even better) but in my experience good
enough.

Andreas

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120112/1b69649d/attachment.html>


More information about the Interest mailing list