BlueHuskyStudios / BlueHuskyStudios/DeadassSimpleMediaPlayer

`isDirectory(at:)` discards prefetched resource values

Open Beginner friendly
#52 0 comments 0 reactions 0 assignees View on GitHub
Automatically found
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.