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

Additional Path functionality #264

Open
ScallyGames opened this issue Nov 17, 2024 · 2 comments
Open

Additional Path functionality #264

ScallyGames opened this issue Nov 17, 2024 · 2 comments

Comments

@ScallyGames
Copy link

ScallyGames commented Nov 17, 2024

I'd love to have some additional functions as part of Path

  • filename (i.e. filename filename "/home/user/project/file.txt" -> "file")
  • extension (i.e. extension "/home/user/project/file.txt" -> "txt")
  • basepath (i.e. basepath "/home/user/project/file.txt" -> "/home/user/project")
  • combine/join (i.e. combine "/home/user/project/" "file.txt" -> "/home/user/project/file.txt"; combine "/home/user/project/" "../other/file.txt" -> "/home/user/other/file.txt"

While these are not terribly difficult string operations I'd expect the platform "standard library" to have functionality for that, especially since there is a bunch of pitfalls with it (path separator, trailing slashes / non trailing slashes, etc). Furthermore most of these functions could/should probably work with both Path and Str types.

@lukewilliamboswell
Copy link
Collaborator

The plan is to make a cross-platform package for working with Paths.

Most of the skeleton/design work is completed here;

https://github.com/roc-lang/path

There's nothing blocking progress afaik, would you be interested in helping with this?

@ScallyGames
Copy link
Author

That seems reasonable, I was wondering about the usefulness of having to reimplement Path on any platform that runs on a system like Windows, Mac or Linux.
Not sure if I have capacity but I'll look into it.

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

2 participants