将用户配置文件放在 Windows 中的位置 [英] Location to put user configuration files in windows

查看:35
本文介绍了将用户配置文件放在 Windows 中的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 python 库,它有一个每个用户的配置文件,可以由库的用户编辑.该库还生成日志文件.在 *nix 上,标准似乎是将它们转储到 $HOME/.library_name 中.

I'm writing a python library that has a per-user configuration file that can be edited by the user of the library. The library also generates logging files. On *nix, the standard seems to be to dump them in $HOME/.library_name.

但是,我不确定如何处理 Windows 用户.在切换到 Linux 之前,我已经使用 Windows 多年了,似乎应用程序倾向于要么 A)依赖 GUI 配置(我宁愿不开发)或 B)在注册表中转储配置数据(这很烦人开发和*nix 配置文件不可移植)

However, I am not sure what to do with Windows users. I've used windows for years before switching to Linux and it seems that applications tended to either A) rely on GUI configuration (which I'd rather not develop) or B) dump configuration data in the registry (which is annoying to develop and not portable with the *nix config files)

我目前也在 Windows 上将文件转储到 $HOME/.library_name 中,但这在 Windows 上感觉很不自然.
我已经考虑将它放在 %APPDATA% 中,应用程序数据往往存在于此,但这有其自身的问题.我最担心的是,外行用户可能甚至不知道该目录在哪里(不像 %HOME/~),而且用户可编辑的配置文件似乎不会正常进入这里.

I currently am dumping the files into the $HOME/.library_name on windows as well, but this feels very unnatural on Windows.
I've considered placing it into %APPDATA%, where application data tends to live, but this has its own problems though. My biggest concern is that lay users might not even know where that directory is (unlike %HOME/~), and user-editable configuration files don't seem to go here normally.

Windows 上每个用户可编辑的配置文件的标准位置是什么?

What is the standard location for per-user editable config files on windows?

推荐答案

%APPDATA% 是这些的正确位置(可能在您库的子目录中).不幸的是,相当多的 *nix 应用程序移植到 Windows 尊重这一点,我最终得到了 .gem、.ssh、.VirtualBox 等,文件夹杂乱无章我的主目录,没有被隐藏默认为 *nix.

%APPDATA% is the right place for these (probably in a subdirectory for your library). Unfortunately a fair number of *nix apps ported to Windows don't respect that and I end up with .gem, .ssh, .VirtualBox, etc., folders cluttering up my home directory and not hidden by default as on *nix.

即使对于不太了解 Windows 目录结构布局的用户,您也可以通过菜单项(或类似项)在编辑器中为他们打开配置文件.

You can make it easy even for users that don't know much about the layout of the Windows directory structure by having a menu item (or similar) that opens the configuration file in an editor for them.

如果可能,请为文件提供一个 GUI 前端,即使它非常简单.Windows 用户会期待一个工具 |选项菜单项会弹出一个对话框,允许他们设置选项,并且没有选项会很尴尬.

If possible, do provide a GUI front-end to the file, though, even if it's quite a simple one. Windows users will expect a Tools | Options menu item that brings up a dialog box allowing them to set options and will be non-plussed by not having one.

这篇关于将用户配置文件放在 Windows 中的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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