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

lexically_normal ignores usage of double dot sometimes #185

Open
mgeplf opened this issue Oct 15, 2024 · 0 comments · May be fixed by #186
Open

lexically_normal ignores usage of double dot sometimes #185

mgeplf opened this issue Oct 15, 2024 · 0 comments · May be fixed by #186

Comments

@mgeplf
Copy link

mgeplf commented Oct 15, 2024

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.

mgeplf added a commit to mgeplf/filesystem that referenced this issue Nov 5, 2024
* originally this was "normalizing" to `"bar"` when it should be `"../../bar"`
* this fixes gulrak#185
@mgeplf mgeplf linked a pull request Nov 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant