From a15e5dd01e15715fc21ac722528234e8dd6da72c Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Sat, 16 Nov 2024 21:46:54 +0100 Subject: [PATCH] Fix file path for particle editor Fixes #3103 --- src/supertux/menu/particle_editor_open.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/supertux/menu/particle_editor_open.cpp b/src/supertux/menu/particle_editor_open.cpp index c8527755188..bcd69dde8f6 100644 --- a/src/supertux/menu/particle_editor_open.cpp +++ b/src/supertux/menu/particle_editor_open.cpp @@ -23,6 +23,7 @@ #include "supertux/level.hpp" #include "supertux/gameconfig.hpp" #include "supertux/menu/menu_storage.hpp" +#include "util/file_system.hpp" #include "util/gettext.hpp" #include "video/compositor.hpp" @@ -58,10 +59,13 @@ ParticleEditorOpen::menu_action(MenuItem& item) switch (item.get_id()) { case MNID_OPEN: - std::replace(m_filename.begin(), m_filename.end(), '\\', '/'); - ParticleEditor::current()->open("/particles/" + m_filename); + { + m_filename = FileSystem::normalize(m_filename); + const auto& filepath = FileSystem::join("/particles/", m_filename); + ParticleEditor::current()->open(filepath); MenuManager::instance().clear_menu_stack(); - break; + } + break; case MNID_CANCEL: MenuManager::instance().clear_menu_stack();