From 7581310ef3c685dd527ae08d3741cadbaa1af453 Mon Sep 17 00:00:00 2001 From: Masusder <59669685+Masusder@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:18:48 +0200 Subject: [PATCH] Too long audio path fix --- FModel/ViewModels/CUE4ParseViewModel.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index cdb6302d..70f0ed94 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -921,8 +921,17 @@ public class CUE4ParseViewModel : ViewModel var wemId = soundSfx.SourceId; if (wwiseReader.WwiseEncodedMedias.TryGetValue(wemId.ToString(), out var wemData)) { - var debugName = kvp.Value.Value.DebugName.ToString(); - var outputPath = Path.Combine(audioEventPath.Replace($".{debugName}", ""), $"{debugName.Replace('\\', '/')} ({wemId})"); + var debugName = kvp.Value.Value.DebugName.ToString(); + var fileName = $"{debugName.Replace('\\', '/')} ({wemId})"; + var outputPath = Path.Combine(audioEventPath.Replace($".{debugName}", ""), fileName); + + // If file path is too long, audio player will fail + if (outputPath.StartsWith('/')) outputPath = outputPath[1..]; + if (Path.Combine(UserSettings.Default.AudioDirectory, outputPath).Length >= 250) + { + outputPath = Path.Combine(projectName, fileName); + } + SaveAndPlaySound(outputPath, "WEM", wemData); } }