-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Single file format #1558
Closed
Closed
Single file format #1558
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…logic for new and open projects
Closing this in favour of a new branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This PR adds an option to save projects as a single file. It uses the NWStorage wrapper class that was created for the 2.0 release which abstracts all interactions with the file system. It was built to handle various ways of storing the project, including as a single file format.
The implementation here keeps the project in a zip file with the
.nwproj
file extension. The zip file's comment field contains a string which meta data, but the data isn't strictly required. However, it contains a type field that lets novelWriter know whether the archive is a project or a backup. In case of it being a backup, it is opened as read only by default.When a single file project is opened, it is extracted into a project folder in novelWriter's data area. The folder name is the SHA1 hash of the file path, so it should be unique for each project. This allows recovery in case of a crash, as it can then check if the folder already exists. The folder is normally deleted when a project is successfully closed.
Side effects:
.nwproj
files rather than.zip
files. They can then be opened as read only projects.nwProject.xml
rather thannwProject.nwx
. The.nwx
extensions is registered as a mime type for folder projects, and keeping it inside the archive can cause confusion when opening manually.Related Issue(s):
Closes #977
Reviewer's Checklist: