diff options
author | Aziz Berkay Yesilyurt <abyesilyurt@gmail.com> | 2021-07-09 01:03:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-09 10:22:26 +0200 |
commit | f62f53f723c591881b7349a7374dce98719caf47 (patch) | |
tree | 6368b6e7eeafe409d1af384e1de99a9d6875a211 /Userland | |
parent | dd476c35cbd9155931aaff61249559a79c3c40cf (diff) | |
download | serenity-f62f53f723c591881b7349a7374dce98719caf47.zip |
ImageViewer: Use LexicalPath to grab current_dir
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/ImageViewer/ViewWidget.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index 59e6da99db..c2382f96db 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -6,6 +6,7 @@ */ #include "ViewWidget.h" +#include <AK/LexicalPath.h> #include <AK/MappedFile.h> #include <AK/StringBuilder.h> #include <LibCore/DirIterator.h> @@ -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); |