-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement FileManager.url{s,}(for:…) and NSSearchPathForDirectoriesInDomains. #1456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci Please test. |
@millenomi I'm not sure if |
@millenomi Sorry, I noticed your changes to |
Looks like RelWithDebugInfo still builds Debug; I need to conditionalize these changes for Release. |
Or, better, see if CI can build for |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@shahmishal The build failed, but the Foundation tests compile and run, thank you! |
@swift-ci please test and merge |
Foundation/FileManager.swift
Outdated
return [ URL(fileURLWithPath: "/home", isDirectory: true) ] | ||
|
||
case .moviesDirectory: | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use _XDGUserDirectory.videos.url
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
We need to update swiftpm to be able to use --debug-foundation flag
|
I think we fixed that with #1495 — I built and tested locally and it seemed to go through. Trying again. |
@swift-ci please test |
The test has not passed but it's not related to this patch. A moment. |
@swift-ci please test |
@millenomi Does this PR need a rebase to resolve the conflict? |
… oh. Yes, yes it does. |
@swift-ci please test |
1 similar comment
@swift-ci please test |
What is the status of this PR? I would love to be able to use |
@swift-ci please test |
TestFoundation/TestFileManager.swift
Outdated
@@ -28,7 +28,10 @@ class TestFileManager : XCTestCase { | |||
("test_homedirectoryForUser", test_homedirectoryForUser), | |||
("test_temporaryDirectoryForUser", test_temporaryDirectoryForUser), | |||
("test_creatingDirectoryWithShortIntermediatePath", test_creatingDirectoryWithShortIntermediatePath), | |||
("test_mountedVolumeURLs", test_mountedVolumeURLs), | |||
("test_mountedVolumeURLs", test_mountedVolumeURLs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a ,
at the end of this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late night merge mistake. Thanks for the catch.
Foundation/FileManager_XDG.swift
Outdated
// Created by Lily Vulcano on 2/26/18. | ||
// Copyright © 2018 Apple. All rights reserved. | ||
// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be the standard swift.org file header
@swift-ci please test. |
Foundation/FileManager.swift
Outdated
self = .user | ||
} | ||
|
||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wont this failable initialiser always fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How so? It didn’t in local testing. (It will fail for bitmasks with more than one bit set and that’s intended.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh dear. Yeah, I see the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch needs some care and attention.
Thank you for working on this! The * This includes SPM, which if it had access to the |
…ectoriesInDomains. Implement urls(for:…) as the primitive directory method: - In Darwin, match paths with the Objective-C implementation wherever possible. - On platforms that use FHS/XDG, implement reading user-dirs.* files to determine XDG directories; Implement url(for:in:…) and NSSearchPathForDirectoriesInDomains() in terms of urls(for:…).
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test and merge |
1 similar comment
@swift-ci please test and merge |
@millenomi It looks like this broke the build on the CI bots, despite having passed PR testing. https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/4410/ |
This is blocking PR testing as well, so I'm going to open a PR to revert. I don't understand how this passed PR testing unless there was a second PR being tested simultaneously and both are required to cause the failure (or perhaps a clean build was required and it didn't happen for the PR testing)? |
On it. |
@millenomi Thanks. Happy to hold off on reverting if we can get this resolved pretty quickly. We have another PR (swiftlang/swift#17140) we're trying to get through to fix another breakage on Linux, and I suspect this issue will block merging that PR. |
@rudkx I will resolve it today, but it requires some work. Let's just revert for now. |
@millenomi Okay, sounds good to me. Thanks! |
Implement urls(for:…) as the primitive directory method:
This patch also enables the
@testable import
syntax in TestFoundation in the Debug configuration.