LibCore: Avoid duplicate '/' in DirIterator::next_full_path()
When the root path of a DirIterator ends with '/', we don't need to add another '/' before appending the file name. Fixes an issue where files found by Assistant had 2 leading slashes.
This commit is contained in:
parent
70278d57ba
commit
e4a55404f1
Notes:
sideshowbarker
2024-07-18 11:03:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e4a55404f18
1 changed files with 6 additions and 1 deletions
|
@ -77,7 +77,12 @@ String DirIterator::next_path()
|
|||
|
||||
String DirIterator::next_full_path()
|
||||
{
|
||||
return String::formatted("{}/{}", m_path, next_path());
|
||||
StringBuilder builder;
|
||||
builder.append(m_path);
|
||||
if (!m_path.ends_with('/'))
|
||||
builder.append('/');
|
||||
builder.append(next_path());
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
String find_executable_in_path(String filename)
|
||||
|
|
Loading…
Add table
Reference in a new issue