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

Wrong behavior if path ends with slash? #46

Closed
horde3d opened this issue Mar 15, 2018 · 2 comments
Closed

Wrong behavior if path ends with slash? #46

horde3d opened this issue Mar 15, 2018 · 2 comments

Comments

@horde3d
Copy link

horde3d commented Mar 15, 2018

If a path ends with a slash the parent() method probably does not return what is expected.
Example:
Path("test/some_path/").parent().path()
will return "test/some_path/".

By changing

auto last_separate_position = m_path.rfind(Path::separate);

to
auto last_separate_position = m_path.rfind(Path::separate, m_path.length() - 2);
it should be ok I guess.

@rusdevops
Copy link
Collaborator

if (first_position != 0) path = Path::root + path;

@rusdevops
Copy link
Collaborator

Thank you for your code review 👍

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

No branches or pull requests

2 participants