From 15b05c78d4a590a58552303153df17be6a92ba1d Mon Sep 17 00:00:00 2001 From: Phoenix Chen Date: Sat, 14 Sep 2019 08:51:01 -0700 Subject: [PATCH] Fix target os for macos. Add missing imports. --- src/connectivity/providers/mod.rs | 2 +- src/connectivity/providers/osx.rs | 5 +---- src/hotspot/providers/mod.rs | 4 ++-- src/hotspot/providers/osx.rs | 1 + src/platforms/mod.rs | 4 ++-- src/platforms/osx.rs | 4 ++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/connectivity/providers/mod.rs b/src/connectivity/providers/mod.rs index c1aefa6..24241b4 100644 --- a/src/connectivity/providers/mod.rs +++ b/src/connectivity/providers/mod.rs @@ -1,6 +1,6 @@ #[cfg(target_os = "linux")] mod linux; -#[cfg(target_os = "osx")] +#[cfg(target_os = "macos")] mod osx; #[cfg(target_os = "windows")] mod windows; diff --git a/src/connectivity/providers/osx.rs b/src/connectivity/providers/osx.rs index 9f51632..383ab85 100644 --- a/src/connectivity/providers/osx.rs +++ b/src/connectivity/providers/osx.rs @@ -17,10 +17,7 @@ impl Connectivity for WiFi { .output() .map_err(|err| WifiConnectionError::FailedToConnect(format!("{}", err)))?; - if !String::from_utf8_lossy(&output.stdout) - .as_ref() - .contains("successfully activated") - { + if String::from_utf8_lossy(&output.stdout).as_ref() != "" { return Ok(false); } diff --git a/src/hotspot/providers/mod.rs b/src/hotspot/providers/mod.rs index edc0ac9..0a3cc29 100644 --- a/src/hotspot/providers/mod.rs +++ b/src/hotspot/providers/mod.rs @@ -4,13 +4,13 @@ mod windows; #[cfg(target_os = "linux")] mod linux; -#[cfg(target_os = "osx")] +#[cfg(target_os = "macos")] mod osx; pub mod prelude { #[cfg(target_os = "linux")] pub use super::linux::*; - #[cfg(target_os = "osx")] + #[cfg(target_os = "macos")] pub use super::osx::*; #[cfg(target_os = "windows")] pub use super::windows::*; diff --git a/src/hotspot/providers/osx.rs b/src/hotspot/providers/osx.rs index 20c8933..80affe9 100644 --- a/src/hotspot/providers/osx.rs +++ b/src/hotspot/providers/osx.rs @@ -1,3 +1,4 @@ +use hotspot::{WifiHotspot, WifiHotspotError}; use connectivity::{Connectivity, WifiConnectionError}; use platforms::WiFi; use std::process::Command; diff --git a/src/platforms/mod.rs b/src/platforms/mod.rs index d9c661e..5567607 100644 --- a/src/platforms/mod.rs +++ b/src/platforms/mod.rs @@ -1,13 +1,13 @@ #[cfg(target_os = "linux")] mod linux; -#[cfg(target_os = "osx")] +#[cfg(target_os = "macos")] mod osx; #[cfg(target_os = "windows")] mod windows; #[cfg(target_os = "linux")] pub use self::linux::{Connection, Linux as WiFi}; -#[cfg(target_os = "osx")] +#[cfg(target_os = "macos")] pub use self::osx::{Connection, Osx as WiFi}; #[cfg(target_os = "windows")] pub use self::windows::{Connection, Windows as WiFi}; diff --git a/src/platforms/osx.rs b/src/platforms/osx.rs index c60b979..7b92ae0 100644 --- a/src/platforms/osx.rs +++ b/src/platforms/osx.rs @@ -1,4 +1,4 @@ -use platforms::{WifiError, WifiInterface}; +use platforms::{Config, WifiError, WifiInterface}; use std::process::Command; #[derive(Debug)] @@ -14,7 +14,7 @@ pub struct Osx { } impl Osx { - pub fn new(name: &str, config: Option) -> Self { + pub fn new(config: Option) -> Self { Osx { connection: None, interface: config.map_or("en0".to_string(), |cfg| {