On Oct 21, 2007, at 2:45 PM, Emanuele Aina wrote:
Jon A. Cruz suggerì:
An alternative is to keep a list of files that *might* be changing and then look at their timestamps when Inkscape regains focus. It's very "low tech", but gets the job done fairly well.
Polling on timestamps could give a lot of headaches as filesystems usually have 1 second granularity, with FAT using a 2 seconds granularity.
That usually doesn't come into play in real world situations.
Consider the use case scenario that we would encounter:
Someone switches to inkscape. inkscape looks to the timestamps It sees that a file has changed. A confirmation dialog for reloading is approved. Inkscape reloads the file... while the user then quickly switches over to a different graphical app Some edit is done in the other app A File|Save is done in the other app the user switches back to inkscape
I'd say that 99.9+% of the time all this will not occur in the small window where the filesystem granularity will go get in the way. However, in the rare case that it might actually happen, it turns out that most users will realize they just did some crazy app speed flipping, and not be bothered that things are missed upon rare occasion.
Another mitigating factor is that most windows users have NTFS, not fat.
And another is that on machines using FAT or such, the system itself is slow enough that it prevents the small window of time from coming to be an actual problem.
(BTW, I've done this with many systems, including Java code since the late nineties)