From f62f53f723c591881b7349a7374dce98719caf47 Mon Sep 17 00:00:00 2001 From: Aziz Berkay Yesilyurt Date: Fri, 9 Jul 2021 01:03:16 +0200 Subject: [PATCH] ImageViewer: Use LexicalPath to grab current_dir --- Userland/Applications/ImageViewer/ViewWidget.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index 59e6da99dbb..c2382f96db5 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -6,6 +6,7 @@ */ #include "ViewWidget.h" +#include #include #include #include @@ -63,12 +64,7 @@ void ViewWidget::navigate(Directions direction) if (m_path == nullptr) return; - auto parts = m_path.split('/'); - parts.remove(parts.size() - 1); - StringBuilder sb; - sb.append("/"); - sb.join("/", parts); - auto current_dir = sb.to_string(); + auto current_dir = LexicalPath(m_path).parent().string(); if (m_files_in_same_dir.is_empty()) { Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots);