From 2d7386f2a3aa6e0f11440a45567ae9205fb9fa09 Mon Sep 17 00:00:00 2001 From: yerke26 Date: Mon, 28 Oct 2024 16:10:10 +0600 Subject: [PATCH] fix write to file --- tools/evm/T8NTool/T8NTool.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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));