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

Change database directory from .DocumentDirectory to .ApplicationSupportDirectory #76

Open
cdzombak opened this issue Jan 7, 2016 · 6 comments
Milestone

Comments

@cdzombak
Copy link
Contributor

cdzombak commented Jan 7, 2016

In a few places, you've recommended storing the SQLite database file in .DocumentDirectory:

What's the rationale behind this recommendation?

I've been placing my databases in .ApplicationSupportDirectory with the understanding that the Documents directory is reserved for files which are meaningful, not opaque, to the user.

Guidelines on this are not perfectly clear, but include these notes:

Put user data in Documents/. User data generally includes any files you might want to expose to the user—anything you might want the user to create, import, delete or edit. For a drawing app, user data includes any graphic files the user might create. For a text editor, it includes the text files.

Put app-created support files in the Library/Application support/ directory. In general, this directory includes files that the app uses to run but that should remain hidden from the user. This directory can also include data files…

Given that, and my recollection of app rejections for placing databases in the Documents directory, I have assumed that opaque datastores like SQLite DBs belong in Application Support, and only text/image and similar files belong in Documents.

Is there additional reasoning behind this recommendation which I may be missing?

@danthorpe
Copy link
Owner

No additional reasoning - all fair points, happy to change this to .ApplicationSupportDirectory.

@danthorpe
Copy link
Owner

If you want to do a pull request that would be great :) I'm in the middle of something else at the moment. But I can get to it in a few hours or so if not.

@danthorpe
Copy link
Owner

I think the change would warrant a new version though - so if you do a pull request to development that will be great, and then I'll do another release this evening.

@cdzombak
Copy link
Contributor Author

cdzombak commented Jan 7, 2016

No additional reasoning - all fair points, happy to change this to .ApplicationSupportDirectory.

I think the change would warrant a new version though

Yeah…changing the databaseNamed implementation would be a breaking change for users, so I'll leave the appropriate amount of caution up to you. ⚠️

If you want to do a pull request that would be great :) I'm in the middle of something else at the moment. But I can get to it in a few hours or so if not.

I'll try to send one later this afternoon—but if I don't, I'll get to it eventually. You don't have to rush to do it!

@danthorpe danthorpe changed the title [Question] Rationale for recommending .DocumentDirectory vs .ApplicationSupportDirectory Change database directory from .DocumentDirectory to .ApplicationSupportDirectory Jan 7, 2016
@danthorpe danthorpe added this to the 2.4 milestone Jan 7, 2016
@cdzombak
Copy link
Contributor Author

cdzombak commented Jan 7, 2016

danthorpe added this to the 2.4 milestone an hour ago

If the implementation of databaseNamed changes to use a different directory by default, IMO we should probably hold off on this issue for a major/breaking 3.0 change, to follow http://semver.org .

@danthorpe
Copy link
Owner

Yeah, that's probably wise. Moving the database file would likely screw up all apps which use the framework.

I'll have a think about making a non-breaking change, and possibly support moving existing database files from the documents directory.

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

No branches or pull requests

2 participants