1

这是一个简单的问题,但可能是主观的,所以我想提出一些意见。

我正在设计一个面向插件的项目,并且我有一个需要自己的配置文件的插件。在不修改核心 API 以适应第三方配置文件的情况下,用户是否可以提供指向该文件的 VM 参数,或者有更好的方法吗?

例子:

-Dcom.unidentified.project.plugin.MyPlugin.configFile="config/Config.xml"

谢谢!

4

2 回答 2

0

Depends on who is your user.If the user is a technician for example it is probably ok.
If it is a normal user then IMO it is not a good idea.User's don't like to know such details and don't actually understand what they are doing ("what the heck is a VM argument?")
I would suggest that you have a predefined folder for your configuration and just publish that to the user. Then you just search that folder.
For example you could have just a config folder that contains all your configuration files e.g. in the user dir or the same dir as your application and the user is aware of this.
Then you search for the Config.xml or any other configuration file there

于 2012-07-08T19:59:25.210 回答
0

我使用多种方法:

  1. 检查 VM 参数
  2. 检查命令行(此处不适用)
  3. 检查 ~/.myapp (是的,它可以在 Windows 上使用 env 变量完成)
  4. 从应用程序启动目录中提取默认值

我发现我拿的第一个。我倾向于只在本地使用 VM 方法来覆盖开发中的正常功能。问题是我什至忘记了当我必须建立一个新环境时。

于 2012-07-08T20:04:18.960 回答