luaur-cli-lib 0.1.3

Shared CLI helpers for the luaur tools.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[cfg(windows)]
pub fn is_directory(path: &str) -> bool {
    use std::os::windows::fs::MetadataExt;
    std::fs::symlink_metadata(path)
        .map(|meta| (meta.file_attributes() & 0x10) != 0)
        .unwrap_or(false)
}

#[cfg(not(windows))]
pub fn is_directory(path: &str) -> bool {
    use std::os::unix::fs::MetadataExt;
    std::fs::symlink_metadata(path)
        .map(|meta| (meta.mode() & 0xf000) == 0x4000)
        .unwrap_or(false)
}