From 06d0cd212e46f9a13acf70cfac5806c2ef3b4274 Mon Sep 17 00:00:00 2001 From: MarcusSakae <113068523+MarcusSakae@users.noreply.github.com> Date: Sat, 25 Feb 2023 17:26:03 +0100 Subject: [PATCH] Attempts to fix #208 Slashes in file-path string gives error on windows. Using std::path::Path should make it viable cross-platform. (Note that I've only tested this on windows) --- src/world_interaction/dialog.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/world_interaction/dialog.rs b/src/world_interaction/dialog.rs index a79ee535..476519fa 100644 --- a/src/world_interaction/dialog.rs +++ b/src/world_interaction/dialog.rs @@ -15,6 +15,7 @@ use bevy_egui::egui::TextStyle::{Body, Button}; use bevy_egui::{egui, EguiContext, EguiPlugin}; use leafwing_input_manager::prelude::ActionState; use serde::{Deserialize, Serialize}; +use std::path::Path; use unicode_segmentation::UnicodeSegmentation; mod resources; @@ -47,7 +48,11 @@ fn set_current_dialog( mut actions_frozen: ResMut, ) -> Result<()> { for dialog_event in dialog_events.iter() { - let path = format!("dialogs/{}.dlg.ron", dialog_event.dialog.0); + let path = Path::new("dialogs") + .join(&dialog_event.dialog.0) + .with_extension("dlg.ron") + .to_string_lossy() + .to_string(); let dialog_handle = match dialog_handles.dialogs.get(&path) { Some(handle) => handle, None => {