From d1978298f04e8865f7153232ae6e82cdc9cff01d Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 3 Feb 2023 05:57:41 -0500 Subject: [PATCH] unixy paths --- .../web_server/handlers/get_next_audio_file_handler.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/programs/aichatbot-sidecar/src/web_server/handlers/get_next_audio_file_handler.rs b/crates/programs/aichatbot-sidecar/src/web_server/handlers/get_next_audio_file_handler.rs index 6701e4eaf0..cc3c5ae7f7 100644 --- a/crates/programs/aichatbot-sidecar/src/web_server/handlers/get_next_audio_file_handler.rs +++ b/crates/programs/aichatbot-sidecar/src/web_server/handlers/get_next_audio_file_handler.rs @@ -17,7 +17,10 @@ pub struct GetNextAudioQuery { pub struct GetNextAudioFileResponse { pub success: bool, pub is_paused: bool, - pub audio_filename: Option, + pub audio_filename_platform: Option, + /// The audio filename, in a Unix style (forward slashes). + /// Note, this might have a windows drive letter. + pub audio_filename_unixy: Option, pub next_cursor: u64, } @@ -70,11 +73,13 @@ pub async fn get_next_audio_file_handler( let next_cursor; let mut audio_filename : Option = None; + let mut audio_filename_unixy : Option = None; if file_exists(&maybe_audio_filename) { next_cursor = request.cursor + 1; audio_filename = maybe_audio_filename.to_str() .map(|s| s.to_string()); + audio_filename_unixy = audio_filename.map(|s| s.replace("\\", "/")); } else { next_cursor = 0; audio_filename = None; @@ -84,7 +89,8 @@ pub async fn get_next_audio_file_handler( success: true, is_paused, next_cursor, - audio_filename, + audio_filename_platform: audio_filename, + audio_filename_unixy, }; let body = serde_json::to_string(&response)