Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion rlottie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ use rgb::{alt::BGRA, RGB};
use rlottie_sys::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(target_os = "linux")]
use std::os::unix::ffi::OsStrExt;
#[cfg(target_os = "macos")]
use std::os::unix::ffi::OsStrExt;
#[cfg(target_os = "windows")]
use std::os::windows::ffi::OsStrExt;
use std::{
ffi::CString,
fmt::{self, Debug},
mem,
os::unix::ffi::OsStrExt,
path::Path,
ptr::NonNull,
slice
Expand All @@ -52,7 +57,12 @@ fn path_to_cstr<P>(path: P) -> CString
where
P: AsRef<Path>
{
#[cfg(target_os = "linux")]
let bytes = path.as_ref().as_os_str().as_bytes().to_vec();
#[cfg(target_os = "macos")]
let bytes = path.as_ref().as_os_str().as_bytes().to_vec();
#[cfg(target_os = "windows")]
let bytes = path.as_ref().as_os_str().as_encoded_bytes().to_vec();
CString::new(bytes).expect("path must not contain nul")
}

Expand Down