mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
25167c383a
commit
c69bf18be8
1 changed files with 17 additions and 2 deletions
|
|
@ -103,8 +103,23 @@ impl Url {
|
|||
|
||||
#[inline]
|
||||
pub fn was_dir(&self) -> bool {
|
||||
let b = self.path.as_os_str().as_encoded_bytes();
|
||||
if let [.., last] = b { *last == MAIN_SEPARATOR as u8 } else { false }
|
||||
// TODO: uncomment this when Rust 1.74 is released
|
||||
// let b = self.path.as_os_str().as_encoded_bytes();
|
||||
// if let [.., last] = b { *last == MAIN_SEPARATOR as u8 } else { false }
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
let b = self.path.as_os_str().as_bytes();
|
||||
if let [.., last] = b { *last == MAIN_SEPARATOR as u8 } else { false }
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let s = self.path.to_string_lossy();
|
||||
let b = s.as_bytes();
|
||||
if let [.., last] = b { *last == MAIN_SEPARATOR as u8 } else { false }
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue