Skip to content

Commit 0b77e67

Browse files
authored
TSCBasic: change spelling for root
Unlike Unix, Windows does not have a singular unified file system root. Instead, you have a forest with up to 26 roots (A-Z). Due to the current design limitations of the Path API, use a drive-relative path as a root to terminate recursion when using the `InMemoryFileSystem` which is required to work towards enabling tests for SPM.
1 parent 79be291 commit 0b77e67

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: Sources/TSCBasic/Path.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,12 @@ extension Path {
470470
private struct WindowsPath: Path {
471471
let string: String
472472

473-
static let root = Self(string: "/")
473+
// NOTE: this is *NOT* a root path. It is a drive-relative path that needs
474+
// to be specified due to assumptions in the APIs. Use the platform
475+
// specific path separator as we should be normalizing the path normally.
476+
// This is required to make the `InMemoryFileSystem` correctly iterate
477+
// paths.
478+
static let root = Self(string: "\\")
474479

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

0 commit comments

Comments
 (0)