Windows7文件位置(特别是DataDirectory) [英] Windows7 file locations (esp. DataDirectory)
本文介绍了Windows7文件位置(特别是DataDirectory)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我这样做:
If I do this:
AppDomain.CurrentDomain.SetData("DataDirectory",System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData));
并让安装程序将文件放在此处,我的程序无法访问它们.
如果我将位置更改为.LocalApplicationData,它可以正常工作,但仅限于安装它的人.
那么,如果普通用户无法访问公用目录,该如何对所有用户"起作用?
我以为Common适用于所有人,LocalApplicationData适用于特定用户,平原.ApplicationData适用于漫游".
我在做什么错?
and have Setup put the files there, my program can''t access them.
If I change the location to .LocalApplicationData, it works just fine, but is restricted to whoever installed it.
So how do make it work for "all users", if a normal user can''t access the common dirs?
I thought Common was for all, LocalApplicationData was for a specific user, and plain .ApplicationData was for "roaming".
What am I doing wrong?
推荐答案
安装程序是否有可能以Admin身份运行,从而在Admin的所有权下创建文件?
另外,您可能需要添加特定于您的应用程序的子文件夹.对于非管理员用户,基本文件夹可能没有写访问权限.
Is it possible that Setup''s running as Admin and thus creates the files under Admin''s ownership?
Also you probably need to add a sub-folder specific to your application. The base folder may not have write-access for non-Admin users.
这篇关于Windows7文件位置(特别是DataDirectory)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文