diff options
author | Karol Kosek <krkk@serenityos.org> | 2021-09-20 00:13:29 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-20 15:59:34 +0200 |
commit | d1846867cd1c8c477afc723b3a6e6705e0915aa3 (patch) | |
tree | efbd27468975ac1eb70c538d0ad765d658842b8f /Userland | |
parent | 9ddd2fdcc5c06253e0eb20db944a5c5c81eb19ae (diff) | |
download | serenity-d1846867cd1c8c477afc723b3a6e6705e0915aa3.zip |
WidgetGallery+MouseSettings: Use LexicalPath::basename()
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/MouseSettings/ThemeWidget.cpp | 3 | ||||
-rw-r--r-- | Userland/Demos/WidgetGallery/GalleryModels.h | 10 |
2 files changed, 5 insertions, 8 deletions
diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp index aa6619bf64..a36bcefd6c 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.cpp +++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp @@ -60,8 +60,7 @@ void MouseCursorModel::invalidate() Cursor cursor; cursor.path = move(path); - auto filename_split = cursor.path.split('/'); - cursor.name = filename_split[3]; + cursor.name = LexicalPath::basename(cursor.path); // FIXME: Animated cursor bitmaps auto cursor_bitmap = Gfx::Bitmap::try_load_from_file(cursor.path); diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h index 4e6008f2c3..b810093d86 100644 --- a/Userland/Demos/WidgetGallery/GalleryModels.h +++ b/Userland/Demos/WidgetGallery/GalleryModels.h @@ -6,6 +6,7 @@ #pragma once +#include <AK/LexicalPath.h> #include <AK/NonnullRefPtr.h> #include <AK/Vector.h> #include <LibCore/DirIterator.h> @@ -69,8 +70,7 @@ public: Cursor cursor; cursor.path = move(path); cursor.bitmap = Gfx::Bitmap::try_load_from_file(cursor.path); - auto filename_split = cursor.path.split('/'); - cursor.name = filename_split[3]; + cursor.name = LexicalPath::basename(cursor.path); m_cursors.append(move(cursor)); } @@ -150,8 +150,7 @@ public: continue; IconSet icon_set; icon_set.big_icon = Gfx::Bitmap::try_load_from_file(path); - auto filename_split = path.split('/'); - icon_set.name = filename_split[3]; + icon_set.name = LexicalPath::basename(path); m_icon_sets.append(move(icon_set)); } @@ -165,8 +164,7 @@ public: continue; IconSet icon_set; icon_set.little_icon = Gfx::Bitmap::try_load_from_file(path); - auto filename_split = path.split('/'); - icon_set.name = filename_split[3]; + icon_set.name = LexicalPath::basename(path); for (size_t i = 0; i < big_icons_found; i++) { if (icon_set.name == m_icon_sets[i].name) { m_icon_sets[i].little_icon = icon_set.little_icon; |