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

Proposal: File.basename and File.dirname #122

Open
joshgoebel opened this issue Sep 20, 2021 · 0 comments
Open

Proposal: File.basename and File.dirname #122

joshgoebel opened this issue Sep 20, 2021 · 0 comments

Comments

@joshgoebel
Copy link
Contributor

This has recently come up in wren-console: joshgoebel#16

Talking about adding:

  • File.dirname(path) - Strip last component from file name
  • File.basename(path) - Strip directory from filenames
  • File.basename(path, suffixes) - Strip directory and suffix from filenames

The existing test infrastructure is a bit frustrating to use for testing like this vs a traditional testing framework. I wanted to open this here to see if there is interest in getting this functionality (basename/dirname) into the official CLI. If not, then we may switch to a much simpler testing framework for these tests. On the other hand, if we wish to upstream this change, then it makes sense to stick with the existing testing infrastructure.

One question if this was to land in CLI proper where should we place "core-like" utility functions, such as stringLastIndexOf... it doesn't seem correct to just leave this laying around in the File class as it may need to be reused more broadly in the future... do we need a util or tools module?

@joshgoebel joshgoebel changed the title Proposal: Basename and dirname for IO/File Proposal: File.basename and File.dirname Sep 20, 2021
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

No branches or pull requests

1 participant