You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to RFC8089 compliance changes for Foundation.URL in Swift 6, URL.path does _NOT_ behave as one might expect, producing a path with a leading slash which will be interpreted by Windows as relative.
Closes#6851
/// This should always be used whenever the file path equivalent of a URL is needed. DO NOT use ``path`` or ``path(percentEncoded:)``, as these deal in terms of the path portion of the URL representation per RFC8089, which on Windows would include a leading slash.
19
+
///
20
+
/// - throws: ``FileURLError`` if the URL does not represent a file or its path is otherwise not representable.
21
+
publicvarfilePath:AbsolutePath{
22
+
get throws{
23
+
guard isFileURL else{
24
+
throwFileURLError.notRepresentable(self)
25
+
}
26
+
returntrywithUnsafeFileSystemRepresentation{ cString in
/// This should always be used whenever the file path equivalent of a URL is needed. DO NOT use ``path`` or ``path(percentEncoded:)``, as these deal in terms of the path portion of the URL representation per RFC8089, which on Windows would include a leading slash.
165
+
///
166
+
/// - throws: ``FileURLError`` if the URL does not represent a file or its path is otherwise not representable.
167
+
fileprivatevarfilePath:String{
168
+
get throws{
169
+
guard isFileURL else{
170
+
throwFileURLError.notRepresentable(self)
171
+
}
172
+
returntrywithUnsafeFileSystemRepresentation{ cString in
0 commit comments