diff --git a/Sources/System/FilePath/FilePath.swift b/Sources/System/FilePath/FilePath.swift index a678ff5..1b57a43 100644 --- a/Sources/System/FilePath/FilePath.swift +++ b/Sources/System/FilePath/FilePath.swift @@ -28,9 +28,6 @@ /// let fd = try FileDescriptor.open(path, .writeOnly, options: .append) /// try fd.closeAfter { try fd.writeAll(message.utf8) } /// -/// TODO(docs): Section on all the new syntactic operations, lexical normalization, decomposition, -/// components, etc. -/// /// File paths conform to the /// and /// and protocols @@ -40,6 +37,9 @@ /// However, the rules for path equivalence /// are file-system–specific and have additional considerations /// like case insensitivity, Unicode normalization, and symbolic links. +/// +// TODO(docs): Section on all the new syntactic operations, lexical normalization, decomposition, +// components, etc. // @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *) public struct FilePath { internal var _storage: SystemString diff --git a/Sources/System/FilePath/FilePathSyntax.swift b/Sources/System/FilePath/FilePathSyntax.swift index 442cda8..693b326 100644 --- a/Sources/System/FilePath/FilePathSyntax.swift +++ b/Sources/System/FilePath/FilePathSyntax.swift @@ -64,9 +64,8 @@ extension FilePath { /// path.starts(with: "/usr/bin/ls///") // true /// path.starts(with: "/us") // false /// - /// TODO(Windows docs): examples with roots, such as whether `\foo\bar` - /// starts with `C:\foo` - /// + // TODO(Windows docs): examples with roots, such as whether `\foo\bar` + // starts with `C:\foo` public func starts(with other: FilePath) -> Bool { guard !other.isEmpty else { return true } return self.root == other.root && components.starts( @@ -85,9 +84,8 @@ extension FilePath { /// path.ends(with: "/usr/bin/ls///") // true /// path.ends(with: "/ls") // false /// - /// TODO(Windows docs): examples with roots, such as whether `C:\foo\bar` - /// ends with `C:bar` - /// + // TODO(Windows docs): examples with roots, such as whether `C:\foo\bar` + // ends with `C:bar` public func ends(with other: FilePath) -> Bool { if other.root != nil { // TODO: anything tricky here for Windows? @@ -453,8 +451,7 @@ extension FilePath { /// path.removePrefix("/us") // false /// path.removePrefix("/usr/local") // true, path is "bin" /// - /// TODO(Windows docs): example with roots - /// + // TODO(Windows docs): example with roots public mutating func removePrefix(_ prefix: FilePath) -> Bool { defer { _invariantCheck() } // FIXME: Should Windows have more nuanced semantics? @@ -476,8 +473,7 @@ extension FilePath { /// } /// // path is "/tmp/foo/bar/../baz" /// - /// TODO(Windows docs): example with roots - /// + // TODO(Windows docs): example with roots public mutating func append(_ component: __owned FilePath.Component) { defer { _invariantCheck() } _append(unchecked: component._slice) @@ -492,8 +488,7 @@ extension FilePath { /// let otherPath: FilePath = "/bin/ls" /// path.append(otherPath.components) // path is "/usr/local/bin/ls" /// - /// TODO(Windows docs): example with roots - /// + // TODO(Windows docs): example with roots public mutating func append( _ components: __owned C ) where C.Element == FilePath.Component { @@ -513,9 +508,8 @@ extension FilePath { /// path.append("static/assets") // "/var/www/website/static/assets" /// path.append("/main.css") // "/var/www/website/static/assets/main.css" /// - /// TODO(Windows docs): example with roots, should we rephrase this "spurious - /// roots"? - /// + // TODO(Windows docs): example with roots, should we rephrase this "spurious + // roots"? public mutating func append(_ other: __owned String) { defer { _invariantCheck() } guard !other.utf8.isEmpty else { return } @@ -529,8 +523,7 @@ extension FilePath { /// Non-mutating version of `append(_:Component)`. /// - /// TODO(Windows docs): example with roots - /// + // TODO(Windows docs): example with roots public __consuming func appending(_ other: __owned Component) -> FilePath { var copy = self copy.append(other) @@ -539,8 +532,7 @@ extension FilePath { /// Non-mutating version of `append(_:C)`. /// - /// TODO(Windows docs): example with roots - /// + // TODO(Windows docs): example with roots public __consuming func appending( _ components: __owned C ) -> FilePath where C.Element == FilePath.Component { @@ -551,8 +543,7 @@ extension FilePath { /// Non-mutating version of `append(_:String)`. /// - /// TODO(Windows docs): example with roots - /// + // TODO(Windows docs): example with roots public __consuming func appending(_ other: __owned String) -> FilePath { var copy = self copy.append(other) @@ -573,23 +564,21 @@ extension FilePath { /// path.push("dir/file.txt") // path is "/tmp/dir/file.txt" /// path.push("/bin") // path is "/bin" /// - /// TODO(Windows docs): examples and docs with roots, update/generalize doc - /// comment - /// + // TODO(Windows docs): examples and docs with roots, update/generalize doc + // comment public mutating func push(_ other: __owned FilePath) { defer { _invariantCheck() } guard other.root == nil else { self = other return } - /// FIXME: Windows drive-relative roots, etc? + // FIXME: Windows drive-relative roots, etc? _append(unchecked: other._storage[...]) } /// Non-mutating version of `push()` /// - /// TODO(Windows docs): examples and docs with roots - /// + // TODO(Windows docs): examples and docs with roots public __consuming func pushing(_ other: __owned FilePath) -> FilePath { var copy = self copy.push(other) diff --git a/Sources/System/FilePath/FilePathWindows.swift b/Sources/System/FilePath/FilePathWindows.swift index db0651e..a86651d 100644 --- a/Sources/System/FilePath/FilePathWindows.swift +++ b/Sources/System/FilePath/FilePathWindows.swift @@ -156,7 +156,7 @@ internal struct WindowsRootInfo { /// * Device disk: `\\.\C:\`, `\\?\C:\` /// * UNC: `\\server\e:\`, `\\?\UNC\server\e:\` /// - /// TODO: NT paths? Admin paths using `$`? + // TODO: NT paths? Admin paths using `$`? case drive(Character) /// A volume with a GUID in a non-traditional path @@ -164,7 +164,7 @@ internal struct WindowsRootInfo { /// * UNC: `\\host\Volume{0000-...}\`, `\\.\UNC\host\Volume{0000-...}\` /// * Device roots: `\\.\Volume{0000-...}\`, `\\?\Volume{000-...}\` /// - /// TODO: GUID type? + // TODO: GUID type? case guid(String) // TODO: Legacy DOS devices, such as COM1?