diff --git a/Il2CppInspector.Common/Outputs/CSharpCodeStubs.cs b/Il2CppInspector.Common/Outputs/CSharpCodeStubs.cs index e6b39d2..43e6293 100644 --- a/Il2CppInspector.Common/Outputs/CSharpCodeStubs.cs +++ b/Il2CppInspector.Common/Outputs/CSharpCodeStubs.cs @@ -263,6 +263,10 @@ namespace Il2CppInspector.Outputs if (!string.IsNullOrEmpty(Path.GetDirectoryName(outFile))) Directory.CreateDirectory(Path.GetDirectoryName(outFile)); + // Sanitize leafname (might be class name with invalid characters) + var leafname = Regex.Replace(Path.GetFileName(outFile), @"[<>:""\|\?\*]", "_"); + outFile = Path.GetDirectoryName(outFile) + Path.DirectorySeparatorChar + leafname; + // Create output file bool fileWritten = false; do {