Skip to content

Commit

Permalink
Fix fs::RemoveRelativePathComponents for paths with a leading dot com…
Browse files Browse the repository at this point in the history
…ponent

Previously, paths like ./worlds would be resolved to /worlds since the
leading dot was considered just as irrelevant as a dot in the middle of
the path.
  • Loading branch information
ShadowNinja committed Nov 24, 2016
1 parent 3af5eef commit e4ee654
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/filesys.cpp
Expand Up @@ -631,7 +631,7 @@ std::string RemoveRelativePathComponents(std::string path)
std::string component = path.substr(component_start,
component_end - component_start);
bool remove_this_component = false;
if(component == "."){
if(component == "." && component_start != 0){
remove_this_component = true;
}
else if(component == ".."){
Expand Down

1 comment on commit e4ee654

@TeTpaAka
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should update the unittest accordingly.

Please sign in to comment.