-
-
Notifications
You must be signed in to change notification settings - Fork 60
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.baseName
throws an exception
#276
Comments
Clarification: the original symptom for the |
philwalk
changed the title
Jun 14, 2024
os.root.baseName
is an empty String, causing it to be equivalent to cwd
in some contexts.os.root.baseName
throws an exception
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A new
scala-cli
bug is caused byos.root.baseName
being an empty stringthrowing an exception.VirtusLab/scala-cli#2954
If a
scala-cli
script resides in the root directory, it crashes with an error message:Although this could be avoided in client code, it would require any
os.Path
object to be tested before referencingbaseName
.One way to avoid the exception would be to redefine
os.root.baseName
as the empty String. However, thejvm
defines the empty String aspwd
, so ifos.root.baseName
is also the empty String, that would make it equal topwd
, which is a problem.Shell environments (mostly) treat the root directory as its own parent, which is much easier to work with. For example,
/usr/bin/basename
takes this approach. The expressionbasename /
resolves to/
.Defining
os.root.baseName
ass"$driveRoot/"
resolves thescala-cli
bug.This is the approach taken by PR #277
The text was updated successfully, but these errors were encountered: