Merge pull request #1 from Phoenix-Chen/master
Fix target os to macos. Add missing imports.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
mod linux;
|
mod linux;
|
||||||
#[cfg(target_os = "osx")]
|
#[cfg(target_os = "macos")]
|
||||||
mod osx;
|
mod osx;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod windows;
|
mod windows;
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ impl Connectivity for WiFi {
|
|||||||
.output()
|
.output()
|
||||||
.map_err(|err| WifiConnectionError::FailedToConnect(format!("{}", err)))?;
|
.map_err(|err| WifiConnectionError::FailedToConnect(format!("{}", err)))?;
|
||||||
|
|
||||||
if !String::from_utf8_lossy(&output.stdout)
|
if String::from_utf8_lossy(&output.stdout).as_ref() != "" {
|
||||||
.as_ref()
|
|
||||||
.contains("successfully activated")
|
|
||||||
{
|
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ mod windows;
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
mod linux;
|
mod linux;
|
||||||
|
|
||||||
#[cfg(target_os = "osx")]
|
#[cfg(target_os = "macos")]
|
||||||
mod osx;
|
mod osx;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub use super::linux::*;
|
pub use super::linux::*;
|
||||||
#[cfg(target_os = "osx")]
|
#[cfg(target_os = "macos")]
|
||||||
pub use super::osx::*;
|
pub use super::osx::*;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub use super::windows::*;
|
pub use super::windows::*;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use hotspot::{WifiHotspot, WifiHotspotError};
|
||||||
use connectivity::{Connectivity, WifiConnectionError};
|
use connectivity::{Connectivity, WifiConnectionError};
|
||||||
use platforms::WiFi;
|
use platforms::WiFi;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
mod linux;
|
mod linux;
|
||||||
#[cfg(target_os = "osx")]
|
#[cfg(target_os = "macos")]
|
||||||
mod osx;
|
mod osx;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod windows;
|
mod windows;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub use self::linux::{Connection, Linux as WiFi};
|
pub use self::linux::{Connection, Linux as WiFi};
|
||||||
#[cfg(target_os = "osx")]
|
#[cfg(target_os = "macos")]
|
||||||
pub use self::osx::{Connection, Osx as WiFi};
|
pub use self::osx::{Connection, Osx as WiFi};
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
pub use self::windows::{Connection, Windows as WiFi};
|
pub use self::windows::{Connection, Windows as WiFi};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use platforms::{WifiError, WifiInterface};
|
use platforms::{Config, WifiError, WifiInterface};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -14,7 +14,7 @@ pub struct Osx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Osx {
|
impl Osx {
|
||||||
pub fn new(name: &str, config: Option<Config>) -> Self {
|
pub fn new(config: Option<Config>) -> Self {
|
||||||
Osx {
|
Osx {
|
||||||
connection: None,
|
connection: None,
|
||||||
interface: config.map_or("en0".to_string(), |cfg| {
|
interface: config.map_or("en0".to_string(), |cfg| {
|
||||||
|
|||||||
Reference in New Issue
Block a user