Handle item replacement directories in FoundationEssentials - #2220
Merged
jmschonfeld merged 3 commits intoSep 4, 2026
Merged
Conversation
Hokila
marked this pull request as draft
August 31, 2026 06:19
Hokila
marked this pull request as ready for review
August 31, 2026 07:21
jmschonfeld
reviewed
Aug 31, 2026
Hokila
force-pushed
the
fix-item-replacement-directory-991-release
branch
2 times, most recently
from
September 2, 2026 06:36
bec3093 to
0357512
Compare
Hokila
force-pushed
the
fix-item-replacement-directory-991-release
branch
from
September 2, 2026 06:37
0357512 to
bb5bd64
Compare
Hokila
marked this pull request as draft
September 2, 2026 06:38
Hokila
marked this pull request as ready for review
September 2, 2026 06:39
jmschonfeld
reviewed
Sep 2, 2026
jmschonfeld
reviewed
Sep 3, 2026
| try? fileManager.removeItem(at: secondReplacementDirectory) | ||
| } | ||
|
|
||
| var isDirectory = false |
Contributor
There was a problem hiding this comment.
There's a discrepancy here between the type of this value in FoundationEssentials and what's available in Foundation, so this test fails to compile in FOUNDATION_FRAMEWORK mode. Could you please update this test to follow the convention set by fileExistsAtPath for handling this difference?
Contributor
Author
There was a problem hiding this comment.
Updated the test to follow the existing fileExistsAtPath convention, using ObjCBool for FOUNDATION_FRAMEWORK and Bool for FoundationEssentials.
Match file existence test declaration
Hokila
force-pushed
the
fix-item-replacement-directory-991-release
branch
from
September 4, 2026 02:46
9bdd55e to
ede2cf2
Compare
jmschonfeld
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Resolves #991.
FoundationEssentials did not handle
.itemReplacementDirectoryinFileManager.url(for:in:appropriateFor:create:). It fell through to normal search-path lookup, which could fail to return a replacement directory.Modifications
.itemReplacementDirectorywith a user-domain reference URL.TemporaryItemswhen appropriate and a writable reference location otherwise.createisfalse, matching corelibs Foundation behavior and avoiding races..systemNumberfile attribute for volume comparison.create: trueandcreate: false, including existence and uniqueness checks.Validation
Using
6.4.x-snapshot-2026-08-28(Apple Swift 6.4-dev):Both
create: trueandcreate: falsecases pass.