From 9878f9774d2c1f90a4079c6d13f47ce4ef2a7fd3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 11 Nov 2022 12:50:31 +0100 Subject: use Path::splitExtension --- editor/tile-editor.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/editor/tile-editor.cpp b/editor/tile-editor.cpp index f396d64a..506cf9f3 100644 --- a/editor/tile-editor.cpp +++ b/editor/tile-editor.cpp @@ -6,6 +6,7 @@ #include "random.hpp" #include "serialize/json-helper.hpp" #include "serialize/tile-atlas.hpp" +#include #include namespace floormat { @@ -22,9 +23,7 @@ void tile_editor::load_atlases() const auto filename = _name + ".json"; for (auto& atlas : json_helper::from_json(Path::join(image_path, filename))) { - StringView name = atlas->name(); - if (auto x = name.findLast('.'); x) - name = name.prefix(x.data()); + const StringView name = Path::splitExtension(atlas->name()).first(); auto& [_, vec] = _permutation; vec.reserve(atlas->num_tiles()); _atlases[name] = atlas; -- cgit v1.2.3