BlueHuskyStudios / BlueHuskyStudios/DeadassSimpleMediaPlayer
`isDirectory(at:)` discards prefetched resource values
- Dominant language
- Swift
- Stars
- 0
- Forks
- 3
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 9
Description
`contentsOfDirectory(at:includingPropertiesForKeys:)` is called with `[.contentTypeKey, .isDirectoryKey]` — precisely so those values are cached on the returned URLs. But `isDirectory(at:)` calls `fileExists(atPath:isDirectory:)`, a fresh syscall that ignores the cache, once per URL in the import loop.
Reading `url.resourceValues(forKeys: [.isDirectoryKey]).isDirectory` would use the prefetched value. (`url.contentType` already does the right thing.)
Contributor guide
Research direction
Start at the import loop that calls isDirectory(at:) after contentsOfDirectory(at:includingPropertiesForKeys:) prefetched .isDirectoryKey and .contentTypeKey. Compare it with url.contentType and read the resource value from each URL instead of making a fresh fileExists(atPath:isDirectory:) syscall. Done means the cached directory value is used for each URL while the import behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100