Fix build when passing TREE_SITTER_GRAMMAR_LIB_DIR
Diff
tree-sitter-grammar-repository/build.rs | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
@@ -44,11 +44,19 @@
};
let (config, query_path) = if dylib {
let config: HelixLanguages = basic_toml::from_str(
&fs::read_to_string(root.join("languages.toml"))
.context("failed to read languages.toml")?,
)
.context("failed to parse helix languages.toml")?;
let config = fs::read_to_string(root.join("languages.toml"))
.context("failed to read helix languages.toml")?;
let language_defs_start = memchr::memmem::find(config.as_bytes(), b"[[language]]")
.context("languages.toml is missing languages")?;
let config = &config[language_defs_start..];
let config: HelixLanguages =
basic_toml::from_str(config).context("failed to parse helix languages.toml")?;
println!("cargo::rustc-link-search=native={}", root.display());