Skip to content

Commit

Permalink
linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
ToyVo committed Dec 5, 2024
1 parent 54ffece commit 0c7c3c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/darwin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
use color_eyre::eyre::{bail, Context};
#[cfg(target_os = "macos")]
use system_configuration::{
core_foundation::{base::TCFType, string::CFString},
sys::dynamic_store_copy_specific::SCDynamicStoreCopyLocalHostName,
};
use tracing::{debug, info};

use crate::commands;
Expand Down Expand Up @@ -32,12 +37,7 @@ fn get_hostname(hostname: Option<String>) -> Result<String> {
match &hostname {
Some(h) => Ok(h.to_owned()),
None => {
let hostname = if cfg!(target_os = "macos") {
use system_configuration::{
core_foundation::{base::TCFType, string::CFString},
sys::dynamic_store_copy_specific::SCDynamicStoreCopyLocalHostName,
};

let hostname = if cfg!(target_os = "macos") {
let ptr = unsafe { SCDynamicStoreCopyLocalHostName(std::ptr::null()) };
if ptr.is_null() {
bail!("Failed to get hostname");
Expand Down

0 comments on commit 0c7c3c7

Please sign in to comment.