New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.conf files are deleted when changes are saved. #493
Comments
I can reproduce this.
Relevant code is in mainwindow.cpp:saveConfig. |
I assume we are talking about using the "Save as..." functionality and now the usual auto-save when the program exits. |
@csete That's right. It would be enough to check if newfile == oldfile and don't do anything (just sync) if they are equal to resolve this bug and keep the current behavior. |
We should use: |
@romeojulietthotel I don't think this makes sense here. QSaveFile is for raw file IO. QSettings already uses QSaveFile internally when writing to disk. |
QSaveFile makes sense to me.
|
What QSaveFile does is writing to a temporary file, and then moving it to the desired location when commit() is called. It avoids incompletely written files (e.g. when the application crashes during writing). In our case, the call to copy failed because the source file was deleted before calling copy. I don't even know how we would use QSaveFile here, other than implementing our own copy operation. |
Copy will fail as it is used even if the file is not deleted. http://doc.qt.io/qt-5/qtwidgets-mainwindows-application-mainwindow-cpp.html |
Copy won't fail if newfile doesn't exist.
The copy operation only fails in the first case, because the source file is deleted. This is addressed in #495. |
@romeojulietthotel can you please check and confirm that the applied fix solves your issue? Thanks. |
Using git master.
Steps to reproduce:
If I can figure it out I will send a PR.
The text was updated successfully, but these errors were encountered: