Skip to content

Commit

Permalink
Add EnsureOutputFolder method and integrate it into EnsureCsProjFile
Browse files Browse the repository at this point in the history
Added a new private method `EnsureOutputFolder` that checks if the
output folder specified by `AxSharpProject.OutputFolder` exists, and
if not, creates it. This method then returns the path to the output
folder.

Modified the `EnsureCsProjFile` method to call the newly added
`EnsureOutputFolder` method. This ensures that the output folder is
created before proceeding with the rest of the method's logic,
preventing potential errors related to missing directories.
  • Loading branch information
PTKu committed Aug 15, 2024
1 parent 1ecc1a4 commit d729b35
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/AXSharp.compiler/src/AXSharp.Cs.Compiler/CsProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,21 @@ private static string GetExecutingAssemblyPath()
}


private string EnsureOutputFolder()
{
if (!Directory.Exists(AxSharpProject.OutputFolder))
{
Directory.CreateDirectory(AxSharpProject.OutputFolder);
}

return AxSharpProject.OutputFolder;
}

private void EnsureCsProjFile()
{
if (AxSharpProject.AxProject.ProjectInfo.Name != null)
{
EnsureOutputFolder();
string expectedCsProjFileFullPath = string.Empty;
string expectedCsProjFile = string.Empty;
if (string.IsNullOrEmpty(this.AxSharpProject.CompilerOptions?.ProjectFile))
Expand Down

0 comments on commit d729b35

Please sign in to comment.