在Mac& Mac上存储非用户特定的应用程序数据Linux-权限 [英] Storing non-user specific application data on Mac & Linux - Permissions

查看:92
本文介绍了在Mac& Mac上存储非用户特定的应用程序数据Linux-权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发布了问题之前有关在Linux上将非用户特定的应用程序数据存储在何处.

I posted this question a while ago regarding where to store non-user specific application data on Linux.

如您所见,我打算在Mac上使用"/Library/Application Support",在Linux上使用"/var/lib"或"/usr/share".

As you can see, I intended to use "/Library/Application Support" on Mac and perhaps "/var/lib" or "/usr/share" on Linux.

在现有应用程序(当前仅适用于Windows)上,我们在Vista& Windows 7和Windows XP上的"\ Documents and Settings \ All Users"(均使用System.getenv("ALLUSERSPROFILE")获取,在Mac或Linux上均不可用).

On an existing application (currently Windows only) we use "\ProgramData" on Vista & Windows 7 and "\Documents and Settings\All Users" on Windows XP (both obtained using System.getenv("ALLUSERSPROFILE"), which does not work on Mac or Linux).

我在Mac& Mac上发现的问题Linux位置(与Windows位置不同)是非root用户/管理员用户无法访问它们,这违背了使用它们的目的.

The problem I am finding with the Mac & Linux locations (unlike the Windows ones) is that they are not accessible by non-root/admin users, which sort of defeats the purpose of using them.

此案例的最佳做法是什么?我们可以简单地将应用程序数据存储在用户的主目录中.实际上,我并不会因此而死,因为当新用户尝试使用该应用程序时,它看起来完全是新的",这似乎是合理的.这给我们带来的主要问题是每个用户都必须输入序列号才能激活应用程序(激活信息是我们需要存储的应用程序数据"的一部分).这不是很理想.

What is the best practice is this case? We could simply store the application data in the user's home directory. I wouldn't actually be dead against this, as it seems reasonable for the application to appear completely 'new' when a new user tries using it. The main problem this gives us is that each user would have to enter the serial number in order to activate the application (the activation info is part of the 'application data' we need to store). This isn't really ideal.

也就是说,如果没有真正的选择,那么我想必须这样做.

That said, if there is no real alternative then I suppose it will have to do.

推荐答案

非用户特定的应用程序数据是什么意思?

  • 应用程序所需的只读资源,例如本地化字符串或按钮图标:

  • Read-only resources needed by application, such as localization strings or button icons:

  • 在Mac上,它们存储在应用程序捆绑包本身的Resources子文件夹
  • 在Linux上,它们可以存储在应用程序二进制文件附近,例如,在/opt/<app>/etc中.

  • on Mac they are stored in application bundle itself, in Resources subfolder
  • on Linux, they can be stored near application binary, in /opt/<app>/etc for instance.

读/写属性,例如序列号:

Read/write properties, such as serial number:

  • 您可以将此信息视为特定于用户的应用程序数据,因此它应该放在$HOME目录中的某处
  • 您可以将此信息视为计算机范围的应用程序数据,在这种情况下,应在软件安装过程中(即具有管理特权)进行设置.
  • you can consider this information as user-specific application data, so it should go somewhere in $HOME directory
  • you can consider this information as computer-wide application data, in which case its setting should be perfomed during software installation process, i.e., with administrative privileges.

这篇关于在Mac&amp; Mac上存储非用户特定的应用程序数据Linux-权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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