diff --git a/ica-rs/src/py/call.rs b/ica-rs/src/py/call.rs index 236a7f2..265d400 100644 --- a/ica-rs/src/py/call.rs +++ b/ica-rs/src/py/call.rs @@ -51,13 +51,11 @@ pub fn verify_plugins() { return; } let plugin_path = plugin_path.unwrap(); - for entry in std::fs::read_dir(plugin_path).unwrap() { - if let Ok(entry) = entry { - let path = entry.path(); - if let Some(ext) = path.extension() { - if ext == "py" && !PyStatus::verify_file(&path) { - need_reload_files.push(path); - } + for entry in std::fs::read_dir(plugin_path).unwrap().flatten() { + let path = entry.path(); + if let Some(ext) = path.extension() { + if ext == "py" && !PyStatus::verify_file(&path) { + need_reload_files.push(path); } } } diff --git a/ica-rs/src/py/mod.rs b/ica-rs/src/py/mod.rs index 24707f1..d7ccb0b 100644 --- a/ica-rs/src/py/mod.rs +++ b/ica-rs/src/py/mod.rs @@ -1,6 +1,7 @@ pub mod call; pub mod class; +use std::path::Path; use std::time::SystemTime; use std::{collections::HashMap, path::PathBuf}; @@ -222,7 +223,7 @@ pub fn get_change_time(path: &PathBuf) -> Option { path.metadata().ok()?.modified().ok() } -pub fn py_module_from_code(content: &str, path: &PathBuf) -> PyResult> { +pub fn py_module_from_code(content: &str, path: &Path) -> PyResult> { Python::with_gil(|py| -> PyResult> { let module: PyResult> = PyModule::from_code( py,