@@ -52,6 +52,8 @@ extension FilePath {
5252 /// * `\Users`
5353 public var isRelative : Bool { !isAbsolute }
5454
55+ // TODO(Windows docs): examples with roots, such as whether `\foo\bar`
56+ // starts with `C:\foo`
5557 /// Returns whether `other` is a prefix of `self`, only considering
5658 /// whole path components.
5759 ///
@@ -64,14 +66,14 @@ extension FilePath {
6466 /// path.starts(with: "/usr/bin/ls///") // true
6567 /// path.starts(with: "/us") // false
6668 ///
67- // TODO(Windows docs): examples with roots, such as whether `\foo\bar`
68- // starts with `C:\foo`
6969 public func starts( with other: FilePath ) -> Bool {
7070 guard !other. isEmpty else { return true }
7171 return self . root == other. root && components. starts (
7272 with: other. components)
7373 }
7474
75+ // TODO(Windows docs): examples with roots, such as whether `C:\foo\bar`
76+ // ends with `C:bar`
7577 /// Returns whether `other` is a suffix of `self`, only considering
7678 /// whole path components.
7779 ///
@@ -84,8 +86,6 @@ extension FilePath {
8486 /// path.ends(with: "/usr/bin/ls///") // true
8587 /// path.ends(with: "/ls") // false
8688 ///
87- // TODO(Windows docs): examples with roots, such as whether `C:\foo\bar`
88- // ends with `C:bar`
8989 public func ends( with other: FilePath ) -> Bool {
9090 if other. root != nil {
9191 // TODO: anything tricky here for Windows?
@@ -441,6 +441,7 @@ extension FilePath {
441441// Modification and concatenation API
442442/*System 0.0.2, @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)*/
443443extension FilePath {
444+ // TODO(Windows docs): example with roots
444445 /// If `prefix` is a prefix of `self`, removes it and returns `true`.
445446 /// Otherwise returns `false`.
446447 ///
@@ -451,7 +452,6 @@ extension FilePath {
451452 /// path.removePrefix("/us") // false
452453 /// path.removePrefix("/usr/local") // true, path is "bin"
453454 ///
454- // TODO(Windows docs): example with roots
455455 public mutating func removePrefix( _ prefix: FilePath ) -> Bool {
456456 defer { _invariantCheck ( ) }
457457 // FIXME: Should Windows have more nuanced semantics?
@@ -462,6 +462,7 @@ extension FilePath {
462462 return true
463463 }
464464
465+ // TODO(Windows docs): example with roots
465466 /// Append a `component` on to the end of this path.
466467 ///
467468 /// Example:
@@ -473,12 +474,12 @@ extension FilePath {
473474 /// }
474475 /// // path is "/tmp/foo/bar/../baz"
475476 ///
476- // TODO(Windows docs): example with roots
477477 public mutating func append( _ component: __owned FilePath. Component ) {
478478 defer { _invariantCheck ( ) }
479479 _append ( unchecked: component. _slice)
480480 }
481481
482+ // TODO(Windows docs): example with roots
482483 /// Append `components` on to the end of this path.
483484 ///
484485 /// Example:
@@ -488,7 +489,6 @@ extension FilePath {
488489 /// let otherPath: FilePath = "/bin/ls"
489490 /// path.append(otherPath.components) // path is "/usr/local/bin/ls"
490491 ///
491- // TODO(Windows docs): example with roots
492492 public mutating func append< C: Collection > (
493493 _ components: __owned C
494494 ) where C. Element == FilePath . Component {
@@ -498,6 +498,8 @@ extension FilePath {
498498 }
499499 }
500500
501+ // TODO(Windows docs): example with roots, should we rephrase this "spurious
502+ // roots"?
501503 /// Append the contents of `other`, ignoring any spurious leading separators.
502504 ///
503505 /// A leading separator is spurious if `self` is non-empty.
@@ -509,8 +511,6 @@ extension FilePath {
509511 /// path.append("static/assets") // "/var/www/website/static/assets"
510512 /// path.append("/main.css") // "/var/www/website/static/assets/main.css"
511513 ///
512- // TODO(Windows docs): example with roots, should we rephrase this "spurious
513- // roots"?
514514 public mutating func append( _ other: __owned String) {
515515 defer { _invariantCheck ( ) }
516516 guard !other. utf8. isEmpty else { return }
@@ -522,18 +522,18 @@ extension FilePath {
522522 _append ( unchecked: otherPath. _storage [ otherPath. _relativeStart... ] )
523523 }
524524
525+ // TODO(Windows docs): example with roots
525526 /// Non-mutating version of `append(_:Component)`.
526527 ///
527- // TODO(Windows docs): example with roots
528528 public __consuming func appending( _ other: __owned Component) -> FilePath {
529529 var copy = self
530530 copy. append ( other)
531531 return copy
532532 }
533533
534+ // TODO(Windows docs): example with roots
534535 /// Non-mutating version of `append(_:C)`.
535536 ///
536- // TODO(Windows docs): example with roots
537537 public __consuming func appending< C: Collection > (
538538 _ components: __owned C
539539 ) -> FilePath where C. Element == FilePath . Component {
@@ -542,15 +542,17 @@ extension FilePath {
542542 return copy
543543 }
544544
545+ // TODO(Windows docs): example with roots
545546 /// Non-mutating version of `append(_:String)`.
546547 ///
547- // TODO(Windows docs): example with roots
548548 public __consuming func appending( _ other: __owned String) -> FilePath {
549549 var copy = self
550550 copy. append ( other)
551551 return copy
552552 }
553553
554+ // TODO(Windows docs): examples and docs with roots, update/generalize doc
555+ // comment
554556 /// If `other` does not have a root, append each component of `other`. If
555557 /// `other` has a root, replaces `self` with other.
556558 ///
@@ -565,8 +567,6 @@ extension FilePath {
565567 /// path.push("dir/file.txt") // path is "/tmp/dir/file.txt"
566568 /// path.push("/bin") // path is "/bin"
567569 ///
568- // TODO(Windows docs): examples and docs with roots, update/generalize doc
569- // comment
570570 public mutating func push( _ other: __owned FilePath) {
571571 defer { _invariantCheck ( ) }
572572 guard other. root == nil else {
@@ -577,9 +577,9 @@ extension FilePath {
577577 _append ( unchecked: other. _storage [ ... ] )
578578 }
579579
580+ // TODO(Windows docs): examples and docs with roots
580581 /// Non-mutating version of `push()`.
581582 ///
582- // TODO(Windows docs): examples and docs with roots
583583 public __consuming func pushing( _ other: __owned FilePath) -> FilePath {
584584 var copy = self
585585 copy. push ( other)
0 commit comments