mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Add static bool LexicalPath::is_absolute_path(StringView path);
This commit is contained in:
parent
a828a0e158
commit
69f5f40617
Notes:
github-actions[bot]
2024-11-19 22:18:28 +00:00
Author: https://github.com/stasoid Commit: https://github.com/LadybirdBrowser/ladybird/commit/69f5f406172 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2189 Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 7 additions and 11 deletions
|
@ -58,9 +58,9 @@ LexicalPath::LexicalPath(ByteString path)
|
|||
}
|
||||
}
|
||||
|
||||
bool LexicalPath::is_absolute() const
|
||||
bool LexicalPath::is_absolute_path(StringView path)
|
||||
{
|
||||
return m_string.starts_with('/');
|
||||
return path.starts_with('/');
|
||||
}
|
||||
|
||||
Vector<ByteString> LexicalPath::parts() const
|
||||
|
|
|
@ -26,7 +26,8 @@ public:
|
|||
|
||||
explicit LexicalPath(ByteString);
|
||||
|
||||
bool is_absolute() const;
|
||||
static bool is_absolute_path(StringView path);
|
||||
bool is_absolute() const { return is_absolute_path(m_string); }
|
||||
ByteString const& string() const { return m_string; }
|
||||
|
||||
StringView dirname() const { return m_dirname; }
|
||||
|
|
|
@ -10,14 +10,9 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
static bool is_absolute_path(StringView path)
|
||||
{
|
||||
return path.length() >= 2 && path[1] == ':';
|
||||
}
|
||||
|
||||
static bool is_root(auto const& parts)
|
||||
{
|
||||
return parts.size() == 1 && is_absolute_path(parts[0]);
|
||||
return parts.size() == 1 && LexicalPath::is_absolute_path(parts[0]);
|
||||
}
|
||||
|
||||
LexicalPath::LexicalPath(ByteString path)
|
||||
|
@ -45,9 +40,9 @@ LexicalPath::LexicalPath(ByteString path)
|
|||
}
|
||||
}
|
||||
|
||||
bool LexicalPath::is_absolute() const
|
||||
bool LexicalPath::is_absolute_path(StringView path)
|
||||
{
|
||||
return is_absolute_path(m_string);
|
||||
return path.length() >= 2 && path[1] == ':';
|
||||
}
|
||||
|
||||
Vector<ByteString> LexicalPath::parts() const
|
||||
|
|
Loading…
Reference in a new issue