diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11c1ede..de35e6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: branches: [master, main] tags: ["*"] + paths-ignore: ['**.md'] concurrency: production diff --git a/DotNetAstGen/Program.cs b/DotNetAstGen/Program.cs index f7b949c..34f5252 100644 --- a/DotNetAstGen/Program.cs +++ b/DotNetAstGen/Program.cs @@ -48,7 +48,8 @@ private static void _RunAstGet(string inputPath, DirectoryInfo rootOutputPath) { _logger?.LogInformation("Parsing directory {dirName}", inputPath); var rootDirectory = new DirectoryInfo(inputPath); - foreach (var inputFile in new DirectoryInfo(inputPath).EnumerateFiles("*.cs")) + foreach (var inputFile in new DirectoryInfo(inputPath).EnumerateFiles("*.cs", + SearchOption.AllDirectories)) { _AstForFile(rootDirectory, rootOutputPath, inputFile); } @@ -89,7 +90,14 @@ private static void _AstForFile(FileSystemInfo rootInputPath, FileSystemInfo roo var outputName = Path.Combine(filePath.DirectoryName ?? "./", $"{Path.GetFileNameWithoutExtension(fullPath)}.json") .Replace(rootInputPath.FullName, rootOutputPath.FullName); - + + // Create dirs if they do not exist + var outputParentDir = Path.GetDirectoryName(outputName); + if (outputParentDir != null) + { + Directory.CreateDirectory(outputParentDir); + } + File.WriteAllText(outputName, jsonString); _logger?.LogInformation("Successfully wrote AST to '{astJsonPath}'", outputName); }