use crate::path;
use which::which;
pub fn run() {
let sgdk_path = path::config_dir().join("SGDK");
let out_html = sgdk_path.join("doc").join("html");
let index_html = out_html.join("index.html");
if out_html.exists() && out_html.is_dir() {
println!(
"📄 SGDK documentation: {}",
out_html.display()
);
if index_html.exists() {
#[cfg(target_os = "macos")]
{
let _ = std::process::Command::new("open").arg(&index_html).status();
}
#[cfg(target_os = "windows")]
{
let _ = std::process::Command::new("cmd")
.args(&["/C", "start", "", &index_html.to_string_lossy()])
.status();
}
#[cfg(all(unix, not(target_os = "macos")))]
{
let _ = std::process::Command::new("xdg-open")
.arg(&index_html)
.status();
}
} else {
println!("index.html not found in doc directory.");
}
return;
}
if which("doxygen").is_err() {
println!("❗ The doxygen command was not found. Please install doxygen.");
} else {
println!("❗ SGDK documentation was not found. Please run `sgdkx install` again to fetch it.");
}
}