Skip to content

Add convenience methods to FileName attribute#48

Merged
Schamper merged 1 commit intomainfrom
improve-index-entry
Nov 24, 2025
Merged

Add convenience methods to FileName attribute#48
Schamper merged 1 commit intomainfrom
improve-index-entry

Conversation

@Schamper
Copy link
Member

@Schamper Schamper commented Nov 6, 2025

Closes #47.

@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.42%. Comparing base (cce5fd7) to head (66cc4c3).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/ntfs/attr.py 36.36% 14 Missing ⚠️
dissect/ntfs/mft.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
- Coverage   88.41%   87.42%   -0.99%     
==========================================
  Files          11       11              
  Lines        1226     1249      +23     
==========================================
+ Hits         1084     1092       +8     
- Misses        142      157      +15     
Flag Coverage Δ
unittests 87.42% <33.33%> (-0.99%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


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)
Copy link
Contributor

@Miauwkeru Miauwkeru Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is faster.

And FILE_ATTRIBUTE.DIRECTORY is not a legal flag in this structure.

@Schamper Schamper requested a review from Miauwkeru November 24, 2025 15:44
@Schamper Schamper merged commit 4bda3bd into main Nov 24, 2025
21 of 23 checks passed
@Schamper Schamper deleted the improve-index-entry branch November 24, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve FileName attribute

2 participants