Skip to content

Commit 46af450

Browse files
committed
fix small bugs
1 parent 06e5e98 commit 46af450

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ForTunCli/src/device_ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::ffi::c_void;
22
use std::mem::{size_of, zeroed};
33
use std::net::IpAddr;
4+
use std::path::Path;
45
use std::process::Command;
56

67
use anyhow::{anyhow, bail, Context};
78
use cidr_utils::cidr::IpCidr;
8-
use std::fs::Path;
99
use std::thread::sleep;
1010
use std::time::Duration;
1111
use version_compare::Version;
@@ -176,8 +176,8 @@ pub fn init_device<T:AsRef<Path>>(
176176
Ok(device)
177177
}
178178

179-
fn install_driver(inf_path: &str) -> anyhow::Result<()> {
180-
let inf_path = HSTRING::from(inf_path);
179+
fn install_driver<T:AsRef<Path>>(inf_path: T) -> anyhow::Result<()> {
180+
let inf_path = HSTRING::from(inf_path.as_ref());
181181
let inf_path = PCWSTR(inf_path.as_ptr());
182182

183183
let ret = unsafe {

ForTunCli/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
mod device_ops;
22
pub mod overlapped_file;
33

4+
use std::path::Path;
45
use crate::overlapped_file::WinOverlappedFile;
56
use anyhow::bail;
67
pub use device_ops::get_net_index;
78
pub use device_ops::init_device;
89
pub use device_ops::net_config;
910
pub use device_ops::AdapterDevice;
1011
use std::sync::Arc;
11-
use std::fs::Path;
1212
use tokio::io;
1313
use windows::core::GUID;
1414
use windows::Win32::Foundation::CloseHandle;

0 commit comments

Comments
 (0)