MCPcopy Create free account
hub / github.com/Glyphack/enderpy / enderpy_root_path

Function enderpy_root_path

compat/src/runpython.rs:32–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30}
31
32fn enderpy_root_path() -> Result<PathBuf> {
33 let mut path = std::env::current_exe().into_diagnostic()?;
34 let enderpy_dir = loop {
35 path.push("Cargo.toml");
36 if path.is_file() {
37 break path.parent().unwrap().to_path_buf();
38 }
39 // Pop off "Cargo.toml" and the current directory name.
40 if !path.pop() || !path.pop() {
41 bail!("Unable to find enderpy_dir.");
42 }
43 };
44 Ok(enderpy_dir)
45}
46
47pub fn default_python_path() -> Result<PathBuf> {
48 let mut result = which("python");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected