Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion os/src-jvm/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package object os {

def root(root: String, fileSystem: FileSystem = FileSystems.getDefault()): Path = {
val path = Path(fileSystem.getPath(root))
assert(path.root == root, s"$root is not a root path")
assert(path.root == root || path.root == root.replace('/', '\\'), s"$root is not a root path")
path
}

Expand Down
2 changes: 1 addition & 1 deletion os/src-native/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package object os {

def root(root: String, fileSystem: FileSystem = FileSystems.getDefault()): Path = {
val path = Path(fileSystem.getPath(root))
assert(path.root == root, s"$root is not a root path")
assert(path.root == root || path.root == root.replace('/', '\\'), s"$root is not a root path")
path
}

Expand Down
6 changes: 4 additions & 2 deletions os/test/src-jvm/PathTestsCustomFilesystem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ object PathTestsCustomFilesystem extends TestSuite {

val testWindows = Tests {
test("cRootPath") {
val p = os.root("C:\\") / "Users"
assert(p.toString == "C:\\Users")
val p1 = os.root("C:\\") / "Users"
assert(p1.toString == "C:\\Users")
val p2 = os.root("C:/") / "Users"
assert(p2.toString == "C:\\Users")
}
}

Expand Down