[英]Best directory to store application data with read\write rights for all users?
Until Windows Vista I saved my application data into the directory where the program was located. 在Windows Vista之前,我将应用程序数据保存到程序所在的目录中。 The most common place was "C:\\Program Files\\MyApplication".
最常见的地方是“C:\\ Program Files \\ MyApplication”。 As we know, under Vista and later the common user does't have rights to write under "Program Files" folder.
我们知道,在Vista之后,普通用户无权在“Program Files”文件夹下写入。 So my first idea was to save the application data under the "All Users\\Application Data" folder.
所以我的第一个想法是将应用程序数据保存在“所有用户\\应用程序数据”文件夹下。 But it seems that this folder has writing restrictions too!
但似乎这个文件夹也有写作限制!
So to sum up, my requirements are: 总而言之,我的要求是:
It's often good to use environment variables so you keep things more generic. 使用环境变量通常很好,所以你可以保持更通用的东西。
Vista has changed some things, with NTFS Junction Points. Vista改变了一些东西,NTFS连接点。 See http://www.svrops.com/svrops/articles/jpoints.htm
见http://www.svrops.com/svrops/articles/jpoints.htm
Anyway, using %appdata% should automagically put files in the proper place on xp/vista/7 无论如何,使用%appdata%应该自动将文件放在xp / vista / 7上的适当位置
There is no such location. 没有这样的位置。 Even on Windows XP (and probably 2000 as well) no such location ever existed;
即使在Windows XP(也可能是2000年)上,也不存在这样的位置; we just think it did because we all ran with administrative privileges.
我们认为这样做是因为我们都运行了管理权限。 It is not until Vista forces us to run as limited user that we realize our incorrect assumptions.
直到Vista强迫我们以有限的用户身份运行才意识到我们的错误假设。 You're going to have to explicitly set the permissions on your directory.
您将不得不明确设置目录的权限。
我将创建一个像所有用户\\应用程序数据\\ YourAppName \\ Shared这样的子文件夹,以便明确该文件夹将包含所有用户可写的文件,并在安装程序中设置权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.