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

查看:201
本文介绍了位置将用户配置文件放在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用户。我使用windows多年后,转换到Linux,似乎应用程序倾向于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)

我目前也将文件转储到$ HOME / .library_name在Windows上,但这在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% (可能在您的库的子目录中)。不幸的是,移植到Windows 的大量* nix应用程序不尊重,我最终以.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天全站免登陆