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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Path.absolute or Path.canonical #162

Open
emilkloeden opened this issue Jan 20, 2024 · 2 comments
Open

Add Path.absolute or Path.canonical #162

emilkloeden opened this issue Jan 20, 2024 · 2 comments
Labels
good first issue Good for newcomers

Comments

@emilkloeden
Copy link

Hi, long time listener, first time problem-maker 馃槄. I am trying to build a simple CLI in roc and when I found the Path module I was hoping to convert a relative path to an absolute one but failed to find the functionality to do so? Did I miss it? Could it be added? (Would offer to try myself but I am painfully aware of my current skill level 鈽猴笍).

My expectation would be that it takes a string representing either a relative or absolute path and returns the absolute path. Java, I think distinguishes between "absolute" and "canonical" paths. To my understanding, the difference is the latter resolves syntax like ".." while the former would just include the ".." in the path. FWIW I personally prefer the latter's behaviour and the former's name.

@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 26, 2024

Hi @emilkloeden :)
I think this addition makes sense!
I propose we call it canonicalize for consistency with Rust.

As a temporary workaround you can use the unix command realpath through Cmd.output.

@Anton-4 Anton-4 added the good first issue Good for newcomers label Jan 26, 2024
@emilkloeden
Copy link
Author

Hi @Anton-4 , thanks for getting back to me. Agree that canonicalize sounds better - it's a verb after all :).

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

No branches or pull requests

2 participants