/Library/Application Support Library是否可供所有用户使用? [英] Is /Library/Application Support Library accessible to all users?

查看:650
本文介绍了/Library/Application Support Library是否可供所有用户使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在/Library/Application Support中放置一个文件,以便无论使用Mac的用户如何,我的应用程序都可以访问其中存储的数据.因此,我计划在/Library/Application Support中创建一个目录并将其放置数据文件.

I need to place a file in /Library/Application Support so that the data stored in there can be accessed by my application irrespective of the user who is using the Mac.So i plan to create a directory within /Library/Application Support and place the data file in it.

创建文件夹并将文件放置在此目录中是否需要root特权.我尝试使用

Is root privileges required to make a folder and place a file in this directory.I tried writing a file using

string s=System.IO.Path.Combine (Environment.GetFolderPath  (Environment.SpecialFolder.Personal), "Library");

System.IO.File.Copy ("myfile.rtf", s + "//Application Support//kk.rtf"); 

该文件已成功写入.对于Macintosh来说,这是一个菜鸟..只要我尝试过,该文件就可以使用.所有用户都可以写入此文件.

The file was written successfully.Im a noob when it comes to Macintosh.. will all users be able to write this file provided that it worked when i tried.

推荐答案

/Library是rwx,由root和rx归他人(车轮组)

/Library is rwx and owned by root and rx to others (wheel group)

即:

drwxr-xr-x+  73 root           wheel    2482 Jul 26 11:15 Library

该目录中的项目仅应为:

Items within that directory are supposed to only be:

drwxr-xr-x  root  wheel

但是,许多第三方应用程序在安装过程中将其破坏并将其目录(和子目录)标记为"rwxrwxr-x"并放入管理组(如Parallels).... /usr/bin等中的文件.今年秋天将在"El Capitan"上崩溃.

But a lot of third-party application break that during their install and flag their directory (and subs) as "rwxrwxr-x" and put in the admin group (like Parallels).... This, along with placing things in /usr/bin, etc.. will break on "El Capitan" this fall.

现在,/Library中的应用程序支持"为"drwxr-xr-x root admin",在正常安装"过程中,您将提供管理员密码,软件安装程序会在其中创建一个子目录以供自己使用/storage,通常标记为"drwxrwxr-x root admin",以便所有用户都可以在此处读写.

Now, "Application Support" within /Library is "drwxr-xr-x root admin" and during a 'normal install', you would supply an admin password and the software installer creates a sub-dir there for its own usage/storage, usually flagged as "drwxrwxr-x root admin" so all users can read and write there.

现在,基于用户家庭的应用程序支持"是免费的读写游戏,但仅适用于当前用户,更改对其他用户不可见,因此大多数应用程序都具有本地首选项来覆盖全局应用程序支持(与Windows注册表相同).

Now a user's home based "Application Support" is free game to r/w but that is only for the current user and changes there are not visible to others, and thus most apps have local preferences to override the global Application Support (same deal as the Windows registry).

因此,放置一个lic文件供该计算机上的所有人共享,将是全球应用程序支持的一种方式,您只需在安装过程中为应用程序创建一个r/w目录.

So, placing a lic file for everyone on that machine to share, global Application Support would be the way to go, you just need to create a r/w directory for your application during your install.

顺便说一句:在应用程序支持中放置单个文件是不行的,只有该级别的目录,因此复制示例中的"/Library/Application Support/kk.rtf"是错误的,请创建您自己的应用程序子目录,目录,然后将kk.rtf保存在那里.

BTW: Placing individual files in Application Support is a no-no, only directories that that level, so copying something like in your example "/Library/Application Support/kk.rtf" is wrong, create your own app sub-directory and than save kk.rtf there.

这篇关于/Library/Application Support Library是否可供所有用户使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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