()
| 118 | const SOURCE_CHROME_INSPECTOR: &str = "chrome-inspector"; |
| 119 | |
| 120 | pub fn chrome_devtools_frontend_root() -> Option<PathBuf> { |
| 121 | if let Ok(path) = std::env::var("SIMDECK_CHROME_DEVTOOLS_FRONTEND_ROOT") { |
| 122 | let path = PathBuf::from(path); |
| 123 | if is_devtools_frontend_root(&path) { |
| 124 | return Some(path); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | let mut roots = Vec::new(); |
| 129 | if let Ok(current_dir) = std::env::current_dir() { |
| 130 | roots.extend(devtools_frontend_candidates_from(¤t_dir)); |
| 131 | } |
| 132 | if let Ok(exe) = std::env::current_exe() { |
| 133 | if let Some(parent) = exe.parent() { |
| 134 | roots.extend(devtools_frontend_candidates_from(parent)); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | roots |
| 139 | .into_iter() |
| 140 | .find(|path| is_devtools_frontend_root(path)) |
| 141 | } |
| 142 | |
| 143 | fn devtools_frontend_candidates_from(start: &Path) -> Vec<PathBuf> { |
| 144 | start |
no test coverage detected