summaryrefslogtreecommitdiffstats
path: root/vendor/gix-path/src/util.rs
blob: 7920910d725bcdbea486e340c490c76a115dfd8c (plain)
1
2
3
4
5
6
7
8
use std::path::Path;

/// return true if `path` is absolute, which depends on the platform but is always true if it starts with a `slash`, hence looks like
/// a linux path.
pub fn is_absolute(path: impl AsRef<Path>) -> bool {
    let path = path.as_ref();
    path.is_absolute() || path.to_str().and_then(|s| s.chars().next()) == Some('/')
}