在哪里存储Windows程序数据文件? [英] Where to store windows program data files?

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

问题描述

我的程序包含了我的程序第一次运行后,会创建并存储updon应用程序使用里面的数据的SQL精简版数据库文件。该数据库在一段时间积聚。
中的数据库文件在程序的安装目录中创建

My program contains a sql lite db file which my program creates after first run and then stores the data inside updon app usage. The database builds up over a period of time. The db file is created in the installation directory of the program

我要更新,当有错误修复定期的应用程序,所以基本上我发布一个新的MSI安装程序,安装程序删除除了数据库文件的旧的安装文件并安装新程序文件。

I have to update the app on a regular basis when there are bugs fixed, so basically I publish a new msi installer, the installer removes old installation files except db file and install new program files.

有些用户不要将它安装到默认位置,以便在他们的选择位置的数据库文件不存在。

Some user's do not install it to the default location so in their selected location the db file is not present.

我想知道它是否可以用来保存数据文件的一些程序数据文件夹中的安装目录之外?所以,我的程序可以从程序数据文件夹..?

I want to know if it's ok to store data files to some program data folder outside the install dir ? so that every new update of my program can access the data from that program data folder.. ?

访问数据的每一个新的更新有没有在Windows XP,Vista和Windows 7的任何程序数据目录?以及如何访问在C#

Is there any program data directory in windows xp, vista and 7 ? and how to access it in C#

感谢,

推荐答案

据是非常危险的存储应用程序文件夹的用户数据。不仅数据如果用户更新销毁或卸载你的应用程序,但标准用户甚至不能写入应用程序目录。

It is very dangerous to store user data in the application folder. Not only will the data be destroyed if the user updates or uninstalls your app, but Standard users cannot even write to the app directory.

我通常包括种子数据库中应用程序并将其复制到 Environment.SpecialFolder.ApplicationData 文件夹应用程序启动时的文件夹。所有用户数据被存储在副本;如果用户卸载应用程序的种子数据库被删除,但用户数据保持。见为例此SO 答案

I typically include a seed database in the application and copy it to a folder in the Environment.SpecialFolder.ApplicationData folder when the application launches. All user data is stored in the copy; if the user uninstalls the application the seed database is deleted but the user data remains. See this SO answer for an example.

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

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