()
| 28 | |
| 29 | #[cfg(target_os = "windows")] |
| 30 | pub fn scan() -> Option<String> { |
| 31 | let cmd = winreg::get( |
| 32 | winreg::HKEY_CLASSES_ROOT, |
| 33 | "vscode\\shell\\open\\command", |
| 34 | "", |
| 35 | )?; |
| 36 | debug!("vscode:// 的注册表项:{}", &cmd); |
| 37 | // The value should be like: |
| 38 | // "C:\Program Files\Microsoft VS Code\Code.exe" --open-url -- "%1" |
| 39 | // and we just use the string inside the first quotation marks |
| 40 | let parts = cmd.split("\"").nth(1)?; |
| 41 | match verify(parts) { |
| 42 | Ok(_) => Some(parts.to_string()), |
| 43 | Err(_) => None, |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | #[cfg(target_os = "linux")] |
| 48 | pub fn scan() -> Option<String> { |
no test coverage detected