diff --git a/AK/LexicalPath.cpp b/AK/LexicalPath.cpp index b810ba2462..2e1035396b 100644 --- a/AK/LexicalPath.cpp +++ b/AK/LexicalPath.cpp @@ -68,6 +68,10 @@ void LexicalPath::canonicalize() } m_dirname = dirname_builder.to_string(); + if (m_dirname.is_empty()) { + m_dirname = m_is_absolute ? "/" : "."; + } + m_basename = canonical_parts.last(); Optional last_dot = StringView(m_basename).find_last_of('.');