Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Move cache.db to a subdirectory - #5601

Merged
friedbunny merged 9 commits into
release-ios-v3.3.0from
fb-offline-cache-subdirectory
Jul 7, 2016
Merged

friedbunny merged 9 commits into
release-ios-v3.3.0from
fb-offline-cache-subdirectory

Conversation

@friedbunny

Copy link
Copy Markdown
Contributor

Per confirmation from @jfirebaugh, we cannot guarantee that the offline and ambient cache.db will be created in a timely/synchronous manner, so it's safer to set the backup exclusion key on its containing directory.

But, because we placed cache.db in the base of the app's Application Support directory (where backups are expected to be allowed), we need to move cache.db into a directory that we control and can exclude from backups with impunity.

This is an amalgam of #5578 (directory exclusion) and #5585 (refactored URL methods, but without the new database size method).

/cc @1ec5 @boundsj @dapetcu21

We cannot guarantee that cache.db will be created in a timely manner, so
it's safer to set the backup exclusion key on its containing directory.

But, because we placed cache.db in the base of the app's Application Support
directory (where backups are expected to be allowed), we need to move
cache.db into a directory that we control and can exclude from backups with impunity.
@friedbunny friedbunny added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline labels Jul 7, 2016
@friedbunny friedbunny added this to the ios-v3.3.0 milestone Jul 7, 2016
@friedbunny friedbunny self-assigned this Jul 7, 2016
~/Library/Application Support/tld.app.bundle.id/mapbox/cache.db
*/
+ (NSURL *)cacheURL {
return [[self class] cacheURLIncludingSubdirectory:YES];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

self is already the class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might as well inline this method since it's so simple.

}
cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier];
if (useSubdirectory) {
cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:@"mapbox"];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd go with something even less likely to conflict with developer code, such as .mapbox. For that matter, I wonder if dot-directories are even backed up to iCloud or Time Machine in the first place.

@1ec5

1ec5 commented Jul 7, 2016

Copy link
Copy Markdown
Contributor

👍

1 similar comment
@boundsj

boundsj commented Jul 7, 2016

Copy link
Copy Markdown
Contributor

👍

@friedbunny
friedbunny merged commit 3fa4f93 into release-ios-v3.3.0 Jul 7, 2016
@friedbunny
friedbunny deleted the fb-offline-cache-subdirectory branch July 7, 2016 16:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS offline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants