配置文件的默认位置

配置文件的默认位置

本文介绍了配置文件的默认位置-MacOS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在跨平台应用程序中,我正在使用一个配置文件,该文件允许用户根据需要覆盖各种默认值.

In a cross-platform application, I am working with a configuration file that allows the user to override various defaults if he wishes to.

我的问题是...在哪里放置/查找此配置文件,尤其是关于MacOS X(我从没使用过并且无法访问)的情况?我知道MacOS X是基于Unix的,但是我也知道许多事情在这里做的非常不同...

The problem I have is... where to place / look for this configuration file, especially with regards to MacOS X (which I never used and have no access to)? I know that MacOS X is based on Unix, but I also know that many things are done very much differently there...

我当前的选择:

Unix:

~/.config/<appname>/<appname>.cfg

Windows(对此也不太确定,这里似乎到处都是-%LOCALAPPDATA%或%USERPROFILE%似乎也是有效的选择):

Windows (shomewhat unsure about this one too, things seem to be all over the place here - %LOCALAPPDATA% or %USERPROFILE% seem to be valid choices too):

%APPDATA%/<appname>/<appname>.cfg

MacOS:

...?

在MacOS或其他选择上有任何评论吗?

Any comments, on MacOS or my other choices?

推荐答案

我认为它必须是~/Library/Application Support/<appname>/<appname>.cfg
请参见 Mac App编程指南:"Mac应用程序环境"->运行时环境的低级详细信息"->文件系统".

I think it must be ~/Library/Application Support/<appname>/<appname>.cfg
See the table in Mac App Programming Guide : "The Mac Application Environment" -> "Low-Level Details of the Runtime Environment" -> "The File System".

这篇关于配置文件的默认位置-MacOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 21:30