diff --git a/src/Compiler/Output/OutputFileStreamFactory.cs b/src/Compiler/Output/OutputFileStreamFactory.cs index 43f877dd..99f59a4c 100644 --- a/src/Compiler/Output/OutputFileStreamFactory.cs +++ b/src/Compiler/Output/OutputFileStreamFactory.cs @@ -2,11 +2,12 @@ namespace Compiler.Output { - public class OutputFileStreamFactory: IOutputStreamFactory + public class OutputFileStreamFactory : IOutputStreamFactory { public TextWriter Make(string file) { + Directory.CreateDirectory(Path.GetDirectoryName(file)!); return new StreamWriter(file); } } -} \ No newline at end of file +} diff --git a/src/Compiler/Output/OutputWriterFactory.cs b/src/Compiler/Output/OutputWriterFactory.cs index fbe7330f..465136db 100644 --- a/src/Compiler/Output/OutputWriterFactory.cs +++ b/src/Compiler/Output/OutputWriterFactory.cs @@ -1,4 +1,5 @@ -using Compiler.Argument; +using System.IO; +using Compiler.Argument; using Compiler.Transformer; namespace Compiler.Output @@ -13,4 +14,4 @@ public static OutputWriter Make(CompilerArguments arguments, string file, IOutpu ); } } -} \ No newline at end of file +} diff --git a/tests/CompilerTest/Output/OutputFileStreamFactoryTest.cs b/tests/CompilerTest/Output/OutputFileStreamFactoryTest.cs index f0984793..3bbcbcca 100644 --- a/tests/CompilerTest/Output/OutputFileStreamFactoryTest.cs +++ b/tests/CompilerTest/Output/OutputFileStreamFactoryTest.cs @@ -9,7 +9,7 @@ public class OutputFileStreamFactoryTest [Fact] public void TestItReturnsStreamWriter() { - Assert.IsType(new OutputFileStreamFactory().Make("test")); + Assert.IsType(new OutputFileStreamFactory().Make("foo/test")); } } -} \ No newline at end of file +}