HMCL-dev / HMCL-dev/HMCL

[Feature] 新的三层配置文件模型

Open
#4,418 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
10.1k
Forks
934
Avg merge
1d 5h
Merged PRs (30d)
82

Description

概述 | Summary

现在 HMCL 使用两级配置文件夹:

  • ./.hmcl (HMCL_CURRENT_DIRECTORY)
  • $XDG_DATA_HOME/.hmcl / %APPDATA%\.hmcl (HMCL_GLOBAL_DIRECTORY)

这两个层次的文件夹共享相似的结构,HMCL 会依次从它们中加载部分资源(例如 font 子文件内的字体)。

我提议新增一个配置文件夹层级:HMCL_CONFIG_DIRECTORY,默认是与 HMCL.jar 同目录下的 .hmcl 文件夹。三层配置文件夹的优先级顺序如下:

  • HMCL_CURRENT_DIRECTORY
  • HMCL_GLOBAL_DIRECTORY
  • HMCL_CONFIG_DIRECTORY

HMCL_CONFIG_DIRECTORY 可以和 HMCL_CURRENT_DIRECTORY 重合(通常来说也会重合)。如果它们不重合,那么 HMCL_CONFIG_DIRECTORY 对于 HMCL 来说是只读的,HMCL 仅会从中读取配置和资源文件,不会修改这个文件夹。

原因 | Reason

这一层级服务于全局安装 HMCL 的情况。一个常见的例子是,在 Linux 发行版上通过包管理器安装 HMCL,这时候 HMCL 通常就会位于完全不可修改的目录下。

通过添加这一层级,第三方在提供 HMCL 软件包的时候能够为 HMCL 提供部分预设配置和资源。

详情 | Description

HMCL 处理这三层配置文件夹时应当遵循「HMCL_CURRENT_DIRECTORY > HMCL_GLOBAL_DIRECTORY > HMCL_CONFIG_DIRECTORY > HMCL 内置」的优先级,将同名资源合并处理。

对于难以合并的资源(比如字体),应该遵循相同的优先级,使高优先级的资源覆盖低优先级的资源。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how HMCL_CURRENT_DIRECTORY and HMCL_GLOBAL_DIRECTORY are resolved and how resources are loaded from them. Define the third HMCL_CONFIG_DIRECTORY layer, including precedence, merging, and read-only behavior when it differs from the current directory. Done means configuration and resources follow the stated three-layer order without modifying a distinct config directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.