Skip to content

Commit

Permalink
TSCBasic: change spelling for root
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
compnerd authored Aug 6, 2022
1 parent 79be291 commit 0b77e67
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/TSCBasic/Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,12 @@ extension Path {
private struct WindowsPath: Path {
let string: String

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

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

0 comments on commit 0b77e67

Please sign in to comment.