WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

A canonical path should have all existing components canonicalized #128

@ForNeVeR

Description

@ForNeVeR

Currently, AbsolutePath::Canonicalize will mostly do nothing for a non-existing path, it will be returned as-is.

Which is mostly fine, but might cause misinterpretation on the user's side: e.g. while myPath.Canonicalize() is okay-ish and follows the spec "canonical if exists", myPath.Canonicalize().Parent is not okay — if myPath doesn't exist then this will not be canonicalized, even if existing.

We should think about this situation, perhaps let's introduce two more methods?

  • CanonicalIfExists(): AbsolutePath?
  • CanonicalRecursive(): AbsolutePath — which will essentially do CanonicalIfExists() ?? Parent.CanonicalRecursive() / FileName — e.g. will try to canonicalize existing parent chain whenever possible

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions