Skip to content

Commit

Permalink
Basics: alter the definition of root for Windows
Browse files Browse the repository at this point in the history
Rather than use a "root" for Windows, use the drive-relative path as a
"root" to terminate iteration/recursion.  Windows does not present the
file system as a unified singular rooted tree and instead has a forest
and thus the level-1 path is conceptually close to the root desired.
  • Loading branch information
compnerd committed May 8, 2022
1 parent 0481abf commit 2fcf5d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Basics/VirtualFileSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ fileprivate enum DirectoryNode: Codable {
switch self {
case .directory(let name, _, _): return name
case .file(let name, _, _, _): return name
#if os(Windows)
case .root(_): return "\\"
#else
case .root(_): return "/"
#endif
}
}

Expand Down

0 comments on commit 2fcf5d9

Please sign in to comment.