Bitwise mode check

This commit is contained in:
Akmadan23 2024-01-13 11:29:16 +01:00 committed by sxyazi
parent 71880a6dcd
commit 46fea7eafb
No known key found for this signature in database

View file

@ -50,11 +50,7 @@ impl Filetype {
return false; return false;
}; };
let mode_bin = format!("{:b}", metadata.permissions().mode()); metadata.permissions().mode() & 0o100111 > 0o100000
return mode_bin.len() == 16 && match *mode_bin.as_bytes() {
[.., _, _, a, _, _, b, _, _, c] => a == b'1' || b == b'1' || c == b'1',
_ => false,
}
}, },
}); });