6

I want to bundle a word list in plain text format with my Cargo package. Can I edit Cargo.toml in order to do this?

If I used npm, I would add this to my package.json:

"files": ["data/my_dictionary.txt"]

I tried include but it doesn't seem to work.

Here is my Cargo.toml

[package]

name = "chamkho"
version = "0.0.2"
authors = ["Vee Satayamas <vsatayamas@gmail.com>"]
test = true
description = "Thai word segmentation/breaking library and command line"
documentation = "https://github.com/veer66/chamkho/blob/master/README.md"
homepage = "https://github.com/veer66/chamkho/"
repository = "https://github.com/veer66/chamkho.git"
readme = "README.md"
keywords = ["text", "nlp", "thai", "library"]
license = "BSD-2-Clause"
include = ["**/*.txt", "**/*.rs","Cargo.toml"]

[[bin]]
name = "wordcut"
path = "src/cli.rs"

This is the output of cargo package -l

Cargo.toml
src/acc.rs
src/cli.rs
src/dict.rs
src/edge.rs
src/graph.rs
src/graph_builder.rs
src/lib.rs
src/space_acc.rs
src/wordcut.rs
tests/wordcut.rs
4

1 回答 1

7

I believe include = ["data/my_dictionary.txt"] should work.

(I opened a PR adding this to the documentation.)

于 2015-03-24T10:28:08.180 回答