MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / find_module_file

Method find_module_file

aiscript-vm/src/module.rs:123–138  ·  view source on GitHub ↗
(&self, name: &InternedString)

Source from the content-addressed store, hash-verified

121 }
122
123 fn find_module_file(&self, name: &InternedString) -> Result<PathBuf, VmError> {
124 let module_name = name.to_str().unwrap();
125 let file_name = format!("{}.ai", module_name);
126
127 for search_path in &self.search_paths {
128 let full_path = search_path.join(&file_name);
129 if full_path.exists() {
130 return Ok(full_path);
131 }
132 }
133
134 Err(VmError::RuntimeError(format!(
135 "Could not find module '{}'.",
136 module_name
137 )))
138 }
139
140 pub fn register_native_module(&mut self, name: InternedString<'gc>, module: ModuleKind<'gc>) {
141 if !name.to_str().unwrap().starts_with("std.") {

Callers 1

get_or_load_moduleMethod · 0.80

Calls 2

RuntimeErrorClass · 0.85
to_strMethod · 0.80

Tested by

no test coverage detected