mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
AK+Everywhere: Remove "null state" of LexicalPath
This removes the default constructor of LexicalPath, and subsequently modifies all its users to accommodate the change.
This commit is contained in:
parent
4c018909f7
commit
d8be530397
Notes:
sideshowbarker
2024-07-18 11:13:24 +09:00
Author: https://github.com/MaxWipfli
Commit: d8be530397
Pull-request: https://github.com/SerenityOS/serenity/pull/8320
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/awesomekling
10 changed files with 52 additions and 52 deletions
|
@ -189,14 +189,14 @@ ModelIndex FileSystemModel::index(String path, int column) const
|
|||
|
||||
FileSystemModel::Node const* FileSystemModel::node_for_path(String const& path) const
|
||||
{
|
||||
LexicalPath lexical_path;
|
||||
if (path == m_root_path) {
|
||||
lexical_path = LexicalPath { "/" };
|
||||
} else if (!m_root_path.is_empty() && path.starts_with(m_root_path)) {
|
||||
lexical_path = LexicalPath { LexicalPath::relative_path(path, m_root_path) };
|
||||
} else {
|
||||
lexical_path = LexicalPath { move(path) };
|
||||
}
|
||||
String resolved_path;
|
||||
if (path == m_root_path)
|
||||
resolved_path = "/";
|
||||
else if (!m_root_path.is_empty() && path.starts_with(m_root_path))
|
||||
resolved_path = LexicalPath::relative_path(path, m_root_path);
|
||||
else
|
||||
resolved_path = path;
|
||||
LexicalPath lexical_path(resolved_path);
|
||||
|
||||
const Node* node = m_root->m_parent_of_root ? &m_root->children.first() : m_root;
|
||||
if (lexical_path.string() == "/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue