Skip to content
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

Restore state from text #1493

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Restore state from text #1493

merged 2 commits into from
Oct 11, 2023

Conversation

manyoso
Copy link
Collaborator

@manyoso manyoso commented Oct 10, 2023

This restores the state from a file even if the model is missing for instance. This is necessary for the new release since all the models will have changed. This will also enable a new feature in an upcoming commit where we have a new setting for always restoring state from text instead of via kvcache so as to limit disk usage.

@manyoso manyoso requested review from zanussbaum, apage43 and cebtenzzre and removed request for zanussbaum October 10, 2023 20:44

if (originalFile.exists())
originalFile.remove();
tempFile.rename(filePath);
Copy link
Member

@apage43 apage43 Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename should be able to atomically replace a file without needing to remove it first. this should be fine either way though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://doc.qt.io/qt-6/qfile.html#rename

If a file with the name newName already exists, rename() returns false (i.e., QFile will not overwrite it).

Copy link
Member

@apage43 apage43 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems reasonable so far - what's this look like in the UI when used?

@manyoso manyoso merged commit f0742c2 into main Oct 11, 2023
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants