@@ -711,10 +711,10 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
711
711
// TODO: Use URLComponents to handle an empty-path case
712
712
/*
713
713
URLByAppendingPathComponent can return nil if:
714
- • the URL does not have a path component. (see note 1)
715
- • a mutable copy of the URLs string could not be created.
716
- • a percent-encoded string of the new path component could not created using the same encoding as the URL's string. (see note 2)
717
- • a new URL object could not be created with the modified URL string.
714
+ * the URL does not have a path component. (see note 1)
715
+ * a mutable copy of the URLs string could not be created.
716
+ * a percent-encoded string of the new path component could not created using the same encoding as the URL's string. (see note 2)
717
+ * a new URL object could not be created with the modified URL string.
718
718
719
719
Note 1: If NS/CFURL parsed URLs correctly, this would not occur because URL strings always have a path component. For example, the URL <mailto:
[email protected] > should be parsed as Scheme=“mailto”, and Path= “
[email protected] ". Instead, CFURL returns false for CFURLCanBeDecomposed(), says Scheme=“mailto”, Path=nil, and ResourceSpecifier=“
[email protected] ”. rdar://problem/15060399
720
720
@@ -742,10 +742,10 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
742
742
public func deletingLastPathComponent( ) throws -> URL {
743
743
/*
744
744
URLByDeletingLastPathComponent can return nil if:
745
- • the URL is a file reference URL which cannot be resolved back to a path.
746
- • the URL does not have a path component. (see note 1)
747
- • a mutable copy of the URLs string could not be created.
748
- • a new URL object could not be created with the modified URL string.
745
+ * the URL is a file reference URL which cannot be resolved back to a path.
746
+ * the URL does not have a path component. (see note 1)
747
+ * a mutable copy of the URLs string could not be created.
748
+ * a new URL object could not be created with the modified URL string.
749
749
*/
750
750
if let result = _url. deletingLastPathComponent. map ( { URL ( reference: $0 as NSURL ) } ) {
751
751
return result
@@ -762,12 +762,12 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
762
762
public func appendingPathExtension( _ pathExtension: String ) throws -> URL {
763
763
/*
764
764
URLByAppendingPathExtension can return nil if:
765
- • the new path extension is not a valid extension (see _CFExtensionIsValidToAppend)
766
- • the URL is a file reference URL which cannot be resolved back to a path.
767
- • the URL does not have a path component. (see note 1)
768
- • a mutable copy of the URLs string could not be created.
769
- • a percent-encoded string of the new path extension could not created using the same encoding as the URL's string. (see note 1))
770
- • a new URL object could not be created with the modified URL string.
765
+ * the new path extension is not a valid extension (see _CFExtensionIsValidToAppend)
766
+ * the URL is a file reference URL which cannot be resolved back to a path.
767
+ * the URL does not have a path component. (see note 1)
768
+ * a mutable copy of the URLs string could not be created.
769
+ * a percent-encoded string of the new path extension could not created using the same encoding as the URL's string. (see note 1))
770
+ * a new URL object could not be created with the modified URL string.
771
771
*/
772
772
guard let result = _url. appendingPathExtension ( pathExtension) else {
773
773
throw NSError ( domain: NSCocoaErrorDomain, code: NSFileReadUnknownError, userInfo: [ : ] )
@@ -781,10 +781,10 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
781
781
public func deletingPathExtension( ) throws -> URL {
782
782
/*
783
783
URLByDeletingPathExtension can return nil if:
784
- • the URL is a file reference URL which cannot be resolved back to a path.
785
- • the URL does not have a path component. (see note 1)
786
- • a mutable copy of the URLs string could not be created.
787
- • a new URL object could not be created with the modified URL string.
784
+ * the URL is a file reference URL which cannot be resolved back to a path.
785
+ * the URL does not have a path component. (see note 1)
786
+ * a mutable copy of the URLs string could not be created.
787
+ * a new URL object could not be created with the modified URL string.
788
788
*/
789
789
if let result = _url. deletingPathExtension. map ( { URL ( reference: $0 as NSURL ) } ) {
790
790
return result
@@ -801,8 +801,8 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
801
801
public func standardizingPath( ) throws -> URL {
802
802
/*
803
803
URLByStandardizingPath can return nil if:
804
- • the URL is a file reference URL which cannot be resolved back to a path.
805
- • a new URL object could not be created with the standardized path).
804
+ * the URL is a file reference URL which cannot be resolved back to a path.
805
+ * a new URL object could not be created with the standardized path).
806
806
*/
807
807
if let result = _url. standardizingPath. map ( { URL ( reference: $0 as NSURL ) } ) {
808
808
return result
@@ -819,9 +819,9 @@ public struct URL : ReferenceConvertible, CustomStringConvertible, Equatable {
819
819
public func resolvingSymlinksInPath( ) throws -> URL {
820
820
/*
821
821
URLByResolvingSymlinksInPath can return nil if:
822
- • the URL is a file reference URL which cannot be resolved back to a path.
823
- • NSPathUtilities' stringByResolvingSymlinksInPath property returns nil.
824
- • a new URL object could not be created with the resolved path).
822
+ * the URL is a file reference URL which cannot be resolved back to a path.
823
+ * NSPathUtilities' stringByResolvingSymlinksInPath property returns nil.
824
+ * a new URL object could not be created with the resolved path).
825
825
*/
826
826
if let result = _url. resolvingSymlinksInPath. map ( { URL ( reference: $0 as NSURL ) } ) {
827
827
return result
0 commit comments