Closed Linya0o closed 2 weeks ago
Is there a simple way to detect these kinds of files? Like, hidden files in Windows have a special 2
set for them:
https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
I don't know rust and the API of OS files. I simply asked chatgpt, and this is the code suggestion it gave. I hope it can help you.
#[cfg(windows)]
{
use std::os::windows::fs::MetadataExt;
// Check if the file is a hidden link and skip it if it is.
if meta.file_attributes() & 2 != 0 { // 2 corresponds to FILE_ATTRIBUTE_HIDDEN
if meta.is_symlink() {
// Skip the hidden link
return Self::dummy(); // or return a default value, depending on your use case
}
attached |= ChaKind::HIDDEN;
}
}
Sorry, I can't accept that because symlinks and hidden files are two different concepts.
Treating symlinks as hidden files would mess with the logic of hidden files. If Windows doesn't provide an extra flag to indicate that a file should be hidden, then it can't be considered a hidden file.
Closing as not doable
yazi --debug
outputPlease describe the problem you're trying to solve
I found out that these links are protected operating system files on Windows.
Would you be willing to contribute this feature?
Describe the solution you'd like
I think these files should not be displayed. Generally, I will not modify or view these links. Windows also does not allow this.
Additional context
No response
Validations