Skip to main content

rl_lang/interpreter/stdlib/path/
mod.rs

1//! `std::path` - path manipulation using [`std::path::PathBuf`].
2//!
3//! All functions take path strings and return strings or booleans.
4//! `path_pop` removes the last component (returns the shortened path).
5//! `path_push` appends a component (same as `path_join`).
6
7mod path_exists;
8mod path_extension;
9mod path_filename;
10mod path_is_dir;
11mod path_is_file;
12mod path_join;
13mod path_parent;
14mod path_pop;
15mod path_push;
16mod path_set_extension;
17mod path_stem;
18
19use crate::interpreter::native::Module;
20
21pub const KEYWORDS: &[&str] = &[
22    "path_exists",
23    "path_extension",
24    "path_filename",
25    "path_is_dir",
26    "path_is_file",
27    "path_join",
28    "path_parent",
29    "path_pop",
30    "path_push",
31    "path_set_extension",
32    "path_stem",
33];
34
35pub fn module() -> Module {
36    Module::new("path")
37        .with_function("path_exists", path_exists::std_path_exists)
38        .with_function("path_extension", path_extension::std_path_extension)
39        .with_function("path_filename", path_filename::std_path_filename)
40        .with_function("path_is_dir", path_is_dir::std_path_is_dir)
41        .with_function("path_is_file", path_is_file::std_path_is_file)
42        .with_function("path_join", path_join::std_path_join)
43        .with_function("path_parent", path_parent::std_path_parent)
44        .with_function("path_pop", path_pop::std_path_pop)
45        .with_function("path_push", path_push::std_path_push)
46        .with_function(
47            "path_set_extension",
48            path_set_extension::std_path_set_extension,
49        )
50        .with_function("path_stem", path_stem::std_path_stem)
51}