Skip to content

Commit 1e38842

Browse files
[Backport 7.7] Clean spec folder before downloading a fresh copy (#4643)
Alternative approach to #4638, keeping it isolated to RestSpecDownloader Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com>
1 parent c681ae2 commit 1e38842

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ApiGenerator/RestSpecDownloader.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ private RestSpecDownloader(string branch)
3838
{
3939
foreach (var spec in specifications)
4040
{
41+
var specFolderOnDisk = Path.Combine(GeneratorLocations.RestSpecificationFolder, spec.FolderOnDisk);
42+
if (Directory.Exists(specFolderOnDisk))
43+
{
44+
Directory.Delete(specFolderOnDisk, true);
45+
pbar.WriteLine($"Deleted target spec folder, before downloading new copy: {specFolderOnDisk}");
46+
}
4147
pbar.Message = $"Downloading rest-api-spec to {spec.FolderOnDisk} for branch {branch}";
4248
DownloadJsonDefinitions(spec, pbar);
4349
pbar.Tick($"Downloaded rest-api-spec to {spec.FolderOnDisk} for branch {branch}");

0 commit comments

Comments
 (0)