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
Qt: Fix saved log filename #14239
Qt: Fix saved log filename #14239
Conversation
elad335
commented
Jul 21, 2023
•
edited
edited
- Allow non-english letters.
- Fix missing ']'.
- Deduplicate spaces.
- Show log directory on success to further simplify log finding.
38a2a32
to
8666b63
Compare
@@ -2413,6 +2413,12 @@ void main_window::CreateConnects() | |||
// Try to copy it if fails | |||
if (fs::copy_file(from, to, true)) | |||
{ | |||
if (fs::file sync_fd{to, fs::write}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a param of copy_file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the move operation not the copy, it's outside the scope of copy_file. It may be added for rename in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't make any sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove file operation may be ordered before file write. On powerloss, this can result in a loss of log file data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn't explain why you didn't make it an option for copy_file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because syncronizing disk file writes is an expensive operation and has very specific use cases. It's better for it not to be in fs::copy_file nor in fs::file::write to avoid misuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's literally the only reason why you would sync.
And that still doesn't explain why it's not a parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be used with caution due to the performance panelty, a programmer can easily use it without giving it too much thought which can be detrimental. Boolean parameter can easily slip in review because it is very subtle. Yes we can add a specially typed constant for it to be very explicit such as file.write(buffer, fs::syncronize_this_write_to_disk) but it seems to be overkill.