MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / default_jassets_path

Function default_jassets_path

rust/src/utils.rs:85–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83}
84
85pub(crate) fn default_jassets_path() -> errors::Result<PathBuf> {
86 let is_build_script = env::var("OUT_DIR").is_ok();
87
88 let mut start_path = if is_build_script {
89 PathBuf::from(env::var("OUT_DIR")?)
90 } else {
91 env::current_exe()?
92 };
93 start_path = canonicalize(start_path)?;
94
95 while start_path.pop() {
96 for entry in std::fs::read_dir(&start_path)? {
97 let path = entry?.path();
98 if path.file_name().map(|x| x == "jassets").unwrap_or(false) {
99 return Ok(path);
100 }
101 }
102 }
103
104 Err(errors::J4RsError::GeneralError("Can not find jassets directory".to_owned()))
105}
106
107pub(crate) fn find_j4rs_dynamic_libraries_names() -> errors::Result<Vec<String>> {
108 let entries: Vec<String> = find_j4rs_dynamic_libraries_dir_entries()?

Callers 3

jassets_pathFunction · 0.85
copy_j4rs_libs_underMethod · 0.85
get_jassets_pathMethod · 0.85

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected