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

Reading the legacy storage format #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

floriankrueger
Copy link

This PR enables Pantry to read its legacy storage format (plist). This is necessary when upgrading from a pre-swift-3 version of the framework a current version, otherwise the storage contents will always be tried to read as JSON (which will fail) and the unpack method will ultimately return nil although all the data was still there.

What this PR does is basically first trying to read the old format for downwards compatibility and only if that fails, read the storage contents as JSON.

You don't NEED to merge the PR if you don't want to as I can see this being a rare edge case but I wanted to offer it anyways. And I can totally see that 'reading the legacy format first' is a overhead that might be too big for the edge case it solves.

Also, I'm open for better approaches to fix this scenario if you have any. This is just a quick fix and honestly the first idea I had. But it works.

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.

1 participant