File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -206,14 +206,18 @@ bool Document::saveFile(const QString& filePath)
206
206
QFile file (filePath);
207
207
m_ioErrorString.clear ();
208
208
209
- // WARNING: If opened in QIODevice::ReadOnly mode, a false positive in QFileSystemWatcher
209
+ // WARNING: If opened in QIODevice::WriteOnly mode, a false positive in QFileSystemWatcher
210
210
// occurs after writing and closing. This is correct for Windows 7.
211
+ // Update: it is possible that when opening a file with this flag, Windows
212
+ // immediately truncates the file size to zero and this happens before
213
+ // disabling monitoring in the code below.
211
214
if (!file.open (QIODevice::ReadWrite)) {
212
215
m_ioErrorString = file.errorString ();
213
216
return false ;
214
217
}
215
218
216
219
fileWatchStop ();
220
+ file.resize (0 );
217
221
file.write (rawData ());
218
222
file.close ();
219
223
fileWatchStart (filePath);
You can’t perform that action at this time.
0 commit comments