refactor: switch to own quirks_path
This commit is contained in:
@@ -10,6 +10,7 @@ use std::{
|
||||
collections::TryReserveError,
|
||||
error::Error,
|
||||
fmt,
|
||||
fmt::Formatter,
|
||||
hash::{Hash, Hasher},
|
||||
io,
|
||||
iter::FusedIterator,
|
||||
@@ -20,7 +21,7 @@ use std::{
|
||||
};
|
||||
|
||||
use ::url::Url;
|
||||
pub use url::PathToUrlError;
|
||||
pub use url::{path_equals_as_file_url, PathToUrlError};
|
||||
use windows::is_windows_sep;
|
||||
|
||||
use crate::{
|
||||
@@ -707,7 +708,7 @@ impl PathBuf {
|
||||
self
|
||||
}
|
||||
|
||||
fn push<P: AsRef<Path>>(&mut self, path: P) {
|
||||
pub fn push<P: AsRef<Path>>(&mut self, path: P) {
|
||||
self._push(path.as_ref())
|
||||
}
|
||||
|
||||
@@ -991,6 +992,12 @@ impl fmt::Debug for PathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for PathBuf {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&**self, formatter)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for PathBuf {
|
||||
type Target = Path;
|
||||
#[inline]
|
||||
@@ -1364,6 +1371,12 @@ impl fmt::Debug for Path {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Path {
|
||||
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&self.inner, formatter)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for Path {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Path) -> bool {
|
||||
|
||||
@@ -95,3 +95,13 @@ pub(crate) fn path_to_file_url_segments(
|
||||
|
||||
Ok((host_end, host_internal))
|
||||
}
|
||||
|
||||
pub fn path_equals_as_file_url<A: AsRef<Path>, B: AsRef<Path>>(
|
||||
a: A,
|
||||
b: B,
|
||||
) -> Result<bool, PathToUrlError> {
|
||||
let u1 = a.as_ref().to_file_url()?;
|
||||
let u2 = b.as_ref().to_file_url()?;
|
||||
|
||||
Ok(u1.as_str() == u2.as_str())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user