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

Provide clearer documenation on use age of / as root #61

Open
bsutton opened this issue Feb 16, 2020 · 3 comments
Open

Provide clearer documenation on use age of / as root #61

bsutton opened this issue Feb 16, 2020 · 3 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@bsutton
Copy link

bsutton commented Feb 16, 2020

The documentation doesn't provide clear guidance on how you stipulate a root path in a cross platform manner.
Whist \tmp isn't an absolute path on windows it does describe a path that is relative to the root directory of the current drive and below I will refer to this as an root relative path.

Reading the documentation its not clear how to stipulate a root relative path.

For instance are each of the following the same:

join('/tmp');
join('/', 'tmp');
join('\tmp');
join('', 'tmp');

It would be useful if the documentation was explicit on this point.

@fdharamshi
Copy link

I want to solve this issue. Can someone guide me through the process?

@lrhn lrhn added the type-enhancement A request for a change that isn't a bug label May 1, 2023
@lrhn
Copy link
Member

lrhn commented May 1, 2023

I can't answer how to do it, which suggests that it is either a documentation issue or a missing feature.

(It's likely that it is a missing feature, since Windows doesn't have canonical root. You might conside \foo a root path in Windows, but Windows doesn't. And the path package likely also doesn't. So there is no concrete feature that can be consistently provided.)

@bsutton
Copy link
Author

bsutton commented May 1, 2023

My questions was really around how you specify '/' in a cross platform manner.

The path package does have the platform specific 'separator' method so you could write:
join(separator, 'tmp');

DCli has the 'rootPath' getter which I use to partially solve this problem. It is relative to the current drive on windows.

https://onepub.dev/documentation?package=dcli_core&version=2.1.0&className=rootPath.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants