Skip to content

Commit

Permalink
Add doc comment explaining find_stub_config
Browse files Browse the repository at this point in the history
  • Loading branch information
ellnix committed Apr 4, 2024
1 parent 38a5801 commit 962cbc1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/stub/stub_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ pub struct StubConfig {
}

impl StubConfig {
/// This function is responsible for searching locations where language
/// config files can be stored.
///
/// Language config files are stored in: (ordered by precedence)
/// 1. The user config dir:
/// `stub_templates/#{lang_arg}/stub_config.toml`
/// 2. This repo, embedded into the binary:
/// `config/stub_templates/#{lang_arg}/stub_config.toml`
///
/// where the user config dir is in `~/.config/clash` (Linux, see the
/// [directories documentation](https://docs.rs/directories/latest/directories/struct.ProjectDirs.html#method.config_dir)
/// for others).
pub fn find_stub_config(lang_name: &str, config_path: &Path) -> Result<Self> {
let user_config_lang_dir = config_path.join(lang_name);

Expand Down

0 comments on commit 962cbc1

Please sign in to comment.