Add convenience methods to FileName attribute#48
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| def is_dir(self) -> bool: | ||
| """Return whether this ``$FILE_NAME`` attribute represents a directory.""" | ||
| return bool(self.attr.FileAttributes & c_ntfs.FILE_NAME_INDEX_PRESENT) |
There was a problem hiding this comment.
With file_attribute above in mind, wouldn't using the resulting value and checking whether the attribute DIRECTORY exists be more logical? With the question: What if FILE_ATTRIBUTE.DIRECTORY is set and not FILE_NAME_INDEX_PRESENT?
There was a problem hiding this comment.
This check is faster.
And FILE_ATTRIBUTE.DIRECTORY is not a legal flag in this structure.
Closes #47.