fix: windows build error

This commit is contained in:
Tunglies 2025-04-16 16:52:22 +08:00
parent 2a908b20eb
commit 3488d89b7d
2 changed files with 10 additions and 11 deletions

View File

@ -1,8 +1,12 @@
use crate::{config::Config, utils::dirs::app_socket_path};
use crate::config::Config;
#[cfg(unix)]
use crate::utils::dirs::app_socket_path;
use mihomo_api;
use once_cell::sync::{Lazy, OnceCell};
use std::sync::Mutex;
use tauri::http::{HeaderMap, HeaderValue};
use tauri::http::HeaderMap;
#[cfg(target_os = "macos")]
use tauri::http::HeaderValue;
#[cfg(target_os = "macos")]
use tokio_tungstenite::tungstenite::http;
@ -70,7 +74,7 @@ impl MihomoManager {
#[cfg(unix)]
let socket_path = app_socket_path().unwrap();
#[cfg(windows)]
let socket_path = r"\\.\pipe\mihomo";
let socket_path = r"\\.\pipe\mihomo".to_string();
socket_path
}
}

View File

@ -1,23 +1,18 @@
use crate::{model::E, sock};
use crate::model::E;
use hyper::Method;
use serde_json::Value;
use tokio_util::codec::{Framed, LinesCodec};
use std::{sync::Arc, time::Duration};
use tokio::{
time::timeout,
sync::Mutex,
};
use std::time::Duration;
use tokio::time::timeout;
use futures::{SinkExt, StreamExt};
use tokio::net::windows::named_pipe::ClientOptions;
pub struct WindowsClient {
lock: Arc<Mutex<()>>,
}
impl WindowsClient {
pub fn new() -> Self {
Self {
lock: Arc::new(Mutex::new(())),
}
}