luaur-cli-lib 0.1.0

Shared CLI helpers for the luaur tools.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pub fn is_absolute_path(path: &str) -> bool {
    #[cfg(windows)]
    {
        let bytes = path.as_bytes();
        (bytes.len() >= 3
            && bytes[0].is_ascii_alphabetic()
            && bytes[1] == b':'
            && (bytes[2] == b'/' || bytes[2] == b'\\'))
            || (bytes.len() >= 1 && (bytes[0] == b'/' || bytes[0] == b'\\'))
    }
    #[cfg(not(windows))]
    {
        let bytes = path.as_bytes();
        bytes.len() >= 1 && bytes[0] == b'/'
    }
}