Skip to content

lexically_normal ignores usage of double dot sometimes #185

Open
@mgeplf

Description

@mgeplf

To Reproduce

#include <iostream>
#include <filesystem>
#include "filesystem.hpp"

int main()
{
    std::string p1 = "./../foo/../bar";
    std::cout << std::filesystem::path(p1).lexically_normal() << '\n';
    std::cout << ghc::filesystem::path(p1).lexically_normal() << '\n' << '\n';

    std::string p0 = "./../foo/../../bar";
    std::cout << std::filesystem::path(p0).lexically_normal() << '\n';
    std::cout << ghc::filesystem::path(p0).lexically_normal() << '\n';

}

The above code produces:

"../bar"                 <-- std::filesystem
"../bar"                 <-- ghc::filesystem

"../../bar"              <-- std::filesystem
"bar"                    <-- ghc::filesystem

If the first "stanza" is correct, than the second stanza should include the ../.., I reckon.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions