build: removed hostname, use whoami instead

whoami provides `hostname` function, so we don't need the hostname dependency, since whoami is also being used for getting the username

closes #398
This commit is contained in:
Christian Visintin
2026-03-13 14:48:09 +01:00
parent 34f1503391
commit a24039bf15
3 changed files with 91 additions and 92 deletions

View File

@@ -49,11 +49,10 @@ impl FileTransferActivity {
let host_bridge_params = self.context().host_bridge_params().unwrap();
match host_bridge_params {
HostBridgeParams::Localhost(_) => {
let hostname = match hostname::get() {
let hostname = match whoami::hostname() {
Ok(h) => h,
Err(_) => return String::from("localhost"),
};
let hostname: String = hostname.as_os_str().to_string_lossy().to_string();
let tokens: Vec<&str> = hostname.split('.').collect();
String::from(*tokens.first().unwrap_or(&"localhost"))
}