Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.root("C:/") fails in Windows #234

Closed
philwalk opened this issue Nov 15, 2023 · 0 comments · Fixed by #235
Closed

os.root("C:/") fails in Windows #234

philwalk opened this issue Nov 15, 2023 · 0 comments · Fixed by #235
Milestone

Comments

@philwalk
Copy link
Contributor

philwalk commented Nov 15, 2023

The following script illustrates the problem:'

#!/usr/bin/env -S scala-cli shebang

//> using scala "3.3.1"
//> using lib "com.lihaoyi::os-lib::0.9.2"

import os._

val root1 = os.root("C:\\")
printf("cRoot: %s\n", root1)
val root2 = os.root("C:/")
printf("cRoot: %s\n", root2)

The output:

# /opt/ue/jsrc/oslibRootBug.sc
cRoot: C:\
Exception in thread "main" java.lang.AssertionError: assertion failed: C:/ is not a root path
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at os.package$.root(package.scala:18)
        at oslibRootBug$_.<init>(oslibRootBug.sc:10)
        at oslibRootBug_sc$.script$lzyINIT1(oslibRootBug.sc:27)
        at oslibRootBug_sc$.script(oslibRootBug.sc:27)
        at oslibRootBug_sc$.main(oslibRootBug.sc:31)
        at oslibRootBug_sc.main(oslibRootBug.sc)

The fix and associated test case are here: #235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants