Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion gcodeworkshop/src/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,18 @@ bool Document::saveFile(const QString& filePath)
QFile file(filePath);
m_ioErrorString.clear();

// WARNING: If opened in QIODevice::ReadOnly mode, a false positive in QFileSystemWatcher
// WARNING: If opened in QIODevice::WriteOnly mode, a false positive in QFileSystemWatcher
// occurs after writing and closing. This is correct for Windows 7.
// Update: it is possible that when opening a file with this flag, Windows
// immediately truncates the file size to zero and this happens before
// disabling monitoring in the code below.
if (!file.open(QIODevice::ReadWrite)) {
m_ioErrorString = file.errorString();
return false;
}

fileWatchStop();
file.resize(0);
file.write(rawData());
file.close();
fileWatchStart(filePath);
Expand Down
Loading