Skip to content

Commit

Permalink
simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed May 5, 2024
1 parent 9f36a42 commit 08cd523
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions crates/transport-ipc/src/connect.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
use interprocess::local_socket as ls;
use std::io;

pub(crate) fn to_name(mut path: &std::ffi::OsStr) -> io::Result<ls::Name<'_>> {
if cfg!(windows) {
if let Some(name) = path.as_encoded_bytes().strip_prefix(br"\\.\pipe\") {
path = unsafe { std::ffi::OsStr::from_encoded_bytes_unchecked(name) }
}
pub(crate) fn to_name(path: &std::ffi::OsStr) -> io::Result<ls::Name<'_>> {
if cfg!(windows) && !path.as_encoded_bytes().starts_with(br"\\.\pipe\") {
ls::ToNsName::to_ns_name::<ls::GenericNamespaced>(path)
} else {
ls::ToFsName::to_fs_name::<ls::GenericFilePath>(path)
Expand Down

0 comments on commit 08cd523

Please sign in to comment.