Detects how tracedecay was installed by inspecting the binary path.
()
| 306 | |
| 307 | /// Detects how tracedecay was installed by inspecting the binary path. |
| 308 | pub fn detect_install_method() -> InstallMethod { |
| 309 | let Ok(exe) = std::env::current_exe() else { |
| 310 | return InstallMethod::Unknown; |
| 311 | }; |
| 312 | let path = exe.to_string_lossy(); |
| 313 | if path.contains(".cargo/bin") || path.contains(".cargo\\bin") { |
| 314 | InstallMethod::Cargo |
| 315 | } else if path.contains("/homebrew/") || path.contains("/Cellar/") { |
| 316 | InstallMethod::Brew |
| 317 | } else if path.contains("\\scoop\\") || path.contains("/scoop/") { |
| 318 | InstallMethod::Scoop |
| 319 | } else { |
| 320 | InstallMethod::Unknown |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | /// Returns the upgrade command string. |
| 325 | /// |