Skip to content

Commit 893b4e8

Browse files
authored
Remove a workaround for a URL.path bug on Windows. (#1263)
This PR removes a workaround for a bug in Foundation's `URL` on Windows where the `path` property would not be formatted correctly. See swiftlang/swift-foundation#1038. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent adcec53 commit 893b4e8

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

Sources/Overlays/_Testing_Foundation/Attachments/Attachment+URL.swift

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,6 @@ private import WinSDK
1717
#endif
1818

1919
#if !SWT_NO_FILE_IO
20-
extension URL {
21-
/// The file system path of the URL, equivalent to `path`.
22-
var fileSystemPath: String {
23-
#if os(Windows)
24-
// BUG: `path` includes a leading slash which makes it invalid on Windows.
25-
// SEE: https://github.com/swiftlang/swift-foundation/pull/964
26-
let path = path
27-
if path.starts(with: /\/[A-Za-z]:\//) {
28-
return String(path.dropFirst())
29-
}
30-
#endif
31-
return path
32-
}
33-
}
34-
3520
extension Attachment where AttachableValue == _AttachableURLWrapper {
3621
#if SWT_TARGET_OS_APPLE
3722
/// An operation queue to use for asynchronously reading data from disk.
@@ -203,8 +188,8 @@ private func _compressContentsOfDirectory(at directoryURL: URL) async throws ->
203188
throw CocoaError(.featureUnsupported, userInfo: [NSLocalizedDescriptionKey: "This platform does not support attaching directories to tests."])
204189
#endif
205190

206-
let sourcePath = directoryURL.fileSystemPath
207-
let destinationPath = temporaryURL.fileSystemPath
191+
let sourcePath = directoryURL.path
192+
let destinationPath = temporaryURL.path
208193
let arguments = {
209194
#if os(Linux) || os(OpenBSD)
210195
// The zip command constructs relative paths from the current working

0 commit comments

Comments
 (0)