Too long audio path fix

This commit is contained in:
Masusder 2025-04-28 13:18:48 +02:00
parent 0d9a2a34e9
commit 7581310ef3

View File

@ -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);
}
}