FFI: Fix tracing log path handling on Windows
Windows uses u16 for OS strings, requiring an owned OsString when converting to Rust. This needs to be stored in its own variable, so we can take an immutable reference to it in Path::new.
This commit is contained in:
parent
682bc15757
commit
a7f695dbae
|
@ -68,12 +68,12 @@ pub extern "C" fn tracing_init(
|
|||
let log_path = unsafe { slice::from_raw_parts(log_path, log_path_len) };
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let log_path = Path::new(OsStr::from_bytes(log_path));
|
||||
let log_path = OsStr::from_bytes(log_path);
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let log_path = Path::new(OsString::from_wide(log_path));
|
||||
let log_path = OsString::from_wide(log_path);
|
||||
|
||||
tracing_init_file(log_path, initial_filter, log_timestamps)
|
||||
tracing_init_file(Path::new(&log_path), initial_filter, log_timestamps)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue