             PathCchRemoveFileSpec(data, path.count)
             return String(decodingCString: data, as: UTF16.self)
         }
-#else
-        // FIXME: This method seems too complicated; it should be simplified,
-        //        if possible, and certainly optimized (using UTF8View).
-        // Find the last path separator.
-        guard let idx = string.lastIndex(of: "/") else {
-            // No path separators, so the directory name is `.`.
-            return "."
-        }
-        // Check if it's the only one in the string.
-        if idx == string.startIndex {
-            // Just one path separator, so the directory name is `/`.
-            return "/"
-        }
-        // Otherwise, it's the string up to (but not including) the last path
-        // separator.
-        return String(string.prefix(upTo: idx))
-#endif
     }
 
     var isAbsolute: Bool {
-#if os(Windows)
-        return UNIXPath.isAbsolutePath(string)
-#else
-        return string.hasPrefix("/")
-#endif
+        return Self.isAbsolutePath(self.string)
+    }
+
+    public var isRoot: Bool {
+        return self.string.withCString(encodedAs: UTF16.self, PathCchIsRoot)
     }
 
     var basename: String {
-#if os(Windows)
         let path: String = self.string
         return path.withCString(encodedAs: UTF16.self) {
             PathStripPathW(UnsafeMutablePointer(mutating: $0))
             return String(decodingCString: $0, as: UTF16.self)
         }
-#else
-        // FIXME: This method seems too complicated; it should be simplified,
-        //        if possible, and certainly optimized (using UTF8View).
-        // Check for a special case of the root directory.
-        if string.spm_only == "/" {
-            // Root directory, so the basename is a single path separator (the
-            // root directory is special in this regard).
-            return "/"
-        }
-        // Find the last path separator.
-        guard let idx = string.lastIndex(of: "/") else {
-            // No path separators, so the basename is the whole string.
-            return string
-        }
-        // Otherwise, it's the string from (but not including) the last path
-        // separator.
-        return String(string.suffix(from: string.index(after: idx)))
-#endif
     }
 
     // FIXME: We should investigate if it would be more efficient to instead

    }
}

private struct UNIXPath: Path {
    let string: String

    static let root = UNIXPath(string: "/")

    static func isValidComponent(_ name: String) -> Bool {
        return name != "" && name != "." && name != ".." && !name.contains("/")
    }

#if os(Windows)
    static func isAbsolutePath(_ path: String) -> Bool {
        return !path.withCString(encodedAs: UTF16.self, PathIsRelativeW)
    }
#endif

    var dirname: String {
#if os(Windows)
        let fsr: UnsafePointer<Int8> = string.fileSystemRepresentation
        defer { fsr.deallocate() }

        let path: String = String(cString: fsr)

    /// Normalized string of the (absolute or relative) path. Never empty.
    var string: String { get }

    /// Returns whether the path is the root path.
    var isRoot: Bool { get }

    /// Returns whether the path is an absolute path.
    var isAbsolute: Bool { get }

