Skip to content

Commit f62f53f

Browse files
abyesilyurtawesomekling
authored andcommitted
ImageViewer: Use LexicalPath to grab current_dir
1 parent dd476c3 commit f62f53f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Userland/Applications/ImageViewer/ViewWidget.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "ViewWidget.h"
9+
#include <AK/LexicalPath.h>
910
#include <AK/MappedFile.h>
1011
#include <AK/StringBuilder.h>
1112
#include <LibCore/DirIterator.h>
@@ -63,12 +64,7 @@ void ViewWidget::navigate(Directions direction)
6364
if (m_path == nullptr)
6465
return;
6566

66-
auto parts = m_path.split('/');
67-
parts.remove(parts.size() - 1);
68-
StringBuilder sb;
69-
sb.append("/");
70-
sb.join("/", parts);
71-
auto current_dir = sb.to_string();
67+
auto current_dir = LexicalPath(m_path).parent().string();
7268

7369
if (m_files_in_same_dir.is_empty()) {
7470
Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots);

0 commit comments

Comments
 (0)