OSX:在哪里存储SQLite文件的应用程序? [英] OSX: Where to store SQLite file for application?

查看:130
本文介绍了OSX:在哪里存储SQLite文件的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的OSX Cocoa应用程序使用SQLite来管理数据。初始化时,我需要指定数据库文件的存储位置。

My OSX Cocoa application uses SQLite to manage data. When initializing, I need to specify where the database file will be stored.

这是什么标准的处理方式?

What is the standard way of handling this?

此数据库文件是运行所必需的(如果应用程序不存在,则会创建它),并且数据应该永久保留,即使在软件更新后可能。

This database file is required to run (the app will create it if it doesn't exist), and the data should be persisted for ever, even after software updates if possible.

我应该在哪里存储?应用程序文件夹?支持文件?

Where should I store it? Application folder? Support Files?

感谢

推荐答案

在应用程序支持文件夹中。即在〜/ Library / Application Support / * YourAppName * / database.db

The convention is to store it in the Application Support folder. i.e. in ~/Library/Application Support/*YourAppName*/database.db

NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);

这篇关于OSX:在哪里存储SQLite文件的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆