mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 20:13:37 +01:00
[beets.util.hidden] Disambiguate Win32 attribute logic
See: <https://github.com/beetbox/beets/pull/5341#discussion_r1658172880>
This commit is contained in:
parent
484400f701
commit
2fc501f398
1 changed files with 6 additions and 2 deletions
|
|
@ -43,8 +43,12 @@ def is_hidden(path: Union[bytes, Path]) -> bool:
|
|||
# Retrieve the attributes for the file.
|
||||
attrs = ctypes.windll.kernel32.GetFileAttributesW(str(path))
|
||||
|
||||
# Ensure we have valid attributes and compare them against the mask.
|
||||
return attrs >= 0 and attrs & hidden_mask
|
||||
# Ensure the attribute mask is valid.
|
||||
if attrs < 0:
|
||||
return False
|
||||
|
||||
# Check for the hidden attribute.
|
||||
return attrs & hidden_mask
|
||||
|
||||
# On OS X, we check for an FS-provided attribute.
|
||||
if sys.platform == "darwin":
|
||||
|
|
|
|||
Loading…
Reference in a new issue