Skip to content

Commit

Permalink
- fixes a bug where clean output for containers would fail when mapped
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Nov 10, 2022
1 parent e48e6da commit 5e966a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ private void CleanOutputDirectory()
if(config.CleanOutput && Directory.Exists(config.OutputPath))
{
logger.LogInformation("Cleaning output directory {path}", config.OutputPath);
Directory.Delete(config.OutputPath, true);
// not using Directory.Delete on the main directory because it's locked when mapped in a container
foreach(var subDir in Directory.EnumerateDirectories(config.OutputPath))
Directory.Delete(subDir, true);
foreach(var subFile in Directory.EnumerateFiles(config.OutputPath))
File.Delete(subFile);
}
}
public async Task<OpenApiUrlTreeNode> GetUrlTreeNodeAsync(CancellationToken cancellationToken) {
Expand Down

0 comments on commit 5e966a9

Please sign in to comment.