Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.4.0
-
None
-
Linux Ubuntu 14.04 LTS 64-bit
Description
An exemple is provided in attachement :
I add the path of an existing file to an instance of FileSystemWatcher.
I connect the signal fileChanged to a slot and set a debug message in the slot.
The problem is visible with modification after the 2nd modification of the file. Step to reproduce :
create a file file.txt
run the program
In console ==>add path "./file.txt"
modify the file
In console ==> file changed : "./file.txt"
count path in watcher : 1
modify the file
In console ==> file changed : "./file.txt"
count path in watcher : 0
==> Now the file is no more watched by the file watcher, it doesn't detect if the file is modified.
The problem is visible with renaming or deleting the file after 1 modification :
create a file file.txt
run the program
In console ==>add path "./file.txt"
modify the file
In console ==> file changed : "./file.txt"
count path in watcher : 1
delete or rename the file
==> the signal is not emmitted
This is not corresponding to the documentation " Note that QFileSystemWatcher stops monitoring files once they have been renamed or removed from disk, and directories once they have been removed from disk." So in case of modification of the file, the watcher must continue to watch the file.
Note : I have tested the signal directoryChanged. It seems to work :
I create an other instance of FileSystem with the path of the directory that contains my file.
I connect the signal directoryChanged.
The slot is called when I rename, removed or modify myFile.
Attachments
Issue Links
- duplicates
-
QTBUG-24898 QFileSystemWatcher (inotify) and editors that rename files
- Closed
- relates to
-
QTBUG-46483 Doc unclear for the QFileSystemWatcher
- Closed