Format exclude_from_content_indexing

This commit is contained in:
Toothbrush 2021-06-28 21:45:59 +01:00 committed by GitHub
parent 9d96a88961
commit f1c8e56909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -685,9 +685,12 @@ fn exclude_from_content_indexing(path: &Path) {
use winapi::um::fileapi::{GetFileAttributesW, SetFileAttributesW};
use winapi::um::winnt::FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
let lp_path: Vec<u16> = path.as_os_str().encode_wide().chain(once(0)).collect();
let path: Vec<u16> = path.as_os_str().encode_wide().chain(once(0)).collect();
unsafe {
SetFileAttributesW(lp_path.as_ptr(), GetFileAttributesW(lp_path.as_ptr()) | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
SetFileAttributesW(
path.as_ptr(),
GetFileAttributesW(path.as_ptr()) | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
);
}
} else {
let _ = path;