util: skip "." completely in normalize_path()

Don't copy "." segments to the final_components list only to remove it
afterwards.
This commit is contained in:
Max Kellermann 2020-01-31 12:03:37 +01:00
parent 0589f295fa
commit 5c0c336c6b

View file

@ -1567,11 +1567,11 @@ string normalize_path(const std::string_view path)
for ( it = components.begin(); it != components.end(); ++it )
{
if ( *it == "" ) continue;
if ( *it == "." && it != components.begin() ) continue;
final_components.push_back(*it);
if ( *it == "." && it != components.begin() )
final_components.pop_back();
else if ( *it == ".." )
if ( *it == ".." )
{
auto cur_idx = final_components.size() - 1;