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

Relative-only paths #23

Open
ForNeVeR opened this issue Apr 21, 2024 · 0 comments
Open

Relative-only paths #23

ForNeVeR opened this issue Apr 21, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ForNeVeR
Copy link
Owner

ForNeVeR commented Apr 21, 2024

Currently, we have the following two types for paths:

  • AbsolutePath for, well, absolute paths,
  • LocalPath for any paths.

We lack a separate type to specify a relative-only type, so let's get one. @PaGrom makes a good argument on its existence, see #1 (comment).

I propose the following design:

struct RelativePath
{
  public RelativePath(string path, bool trimLeadingSlash = false) {}
}

Examples:

new RelativePath("foo/bar") // => foo/bar
new RelativePath("/foo/bar", trimLeadingSlash = true) // => foo/bar
new RelativePath("/foo/bar"); // exception

Whether trimLeadingSlash should be true or false by default I am not sure. @PaGrom, what do you think? I would lean towards more strict behavior by default.

See TODO[#23] in the project sources when implementing this.

@ForNeVeR ForNeVeR added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant