()
| 83 | } |
| 84 | |
| 85 | pub(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 | |
| 107 | pub(crate) fn find_j4rs_dynamic_libraries_names() -> errors::Result<Vec<String>> { |
| 108 | let entries: Vec<String> = find_j4rs_dynamic_libraries_dir_entries()? |
no test coverage detected