Skip to content

Commit

Permalink
Change get hostname mode to fit android
Browse files Browse the repository at this point in the history
  • Loading branch information
GenshinMinecraft committed Dec 10, 2024
1 parent 74955db commit 6767996
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/get_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,5 @@ pub async fn get_uptime_info() -> Result<(u64, f64, f64, f64), Box<dyn std::erro
}

pub fn get_hostname() -> String {
match whoami::hostname() {
Ok(hostname) => {
if hostname == "localhost".to_string() {
panic!("无法获取主机名")
}
hostname
}
Err(_) => panic!("无法获取主机名"),
}
whoami::hostname().unwrap_or_else(|_| "UnknownHostname".to_string())
}

0 comments on commit 6767996

Please sign in to comment.