Open ScallyGames opened 3 hours ago
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?
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.
I'd love to have some additional functions as part of Path
filename "/home/user/project/file.txt"
->"file"
)extension "/home/user/project/file.txt"
->"txt"
)basepath "/home/user/project/file.txt"
->"/home/user/project"
)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.