     /// string consisting of just `.` if there is no directory part (which is
     /// the case if and only if there is no path separator).
     fileprivate var dirname: String {
+#if os(Windows)
+        let dir = string.deletingLastPathComponent
+        return dir == "" ? "." : dir
+#else
         // FIXME: This method seems too complicated; it should be simplified,
         //        if possible, and certainly optimized (using UTF8View).
         // Find the last path separator.

 See http://swift.org/LICENSE.txt for license information
 See http://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

/// Represents an absolute file system path, independently of what (or whether
/// anything at all) exists at that path in the file system at any given time.

        // Otherwise, it's the string up to (but not including) the last path
        // separator.
        return String(string.prefix(upTo: idx))
#endif
    }

    fileprivate var basename: String {
