mirror of
https://github.com/veeso/termscp.git
synced 2026-04-02 08:12:19 -07:00
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:
@@ -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"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user