diff --git a/tools/evm/T8NTool/T8NTool.cs b/tools/evm/T8NTool/T8NTool.cs index 2a70d19d8e2..6e62c9c8965 100644 --- a/tools/evm/T8NTool/T8NTool.cs +++ b/tools/evm/T8NTool/T8NTool.cs @@ -114,7 +114,14 @@ private T8NExecutionResult Execute( private void WriteToFile(string filename, string? basedir, object outputObject) { - FileInfo fileInfo = new(basedir + filename); + if (basedir is not null) + { + basedir = basedir.TrimEnd('/'); + basedir += '/'; + } + + var fileInfo = new FileInfo(basedir + filename); + Directory.CreateDirectory(fileInfo.DirectoryName!); using StreamWriter writer = new(fileInfo.FullName); writer.Write(_ethereumJsonSerializer.Serialize(outputObject, true));