external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks.Tests/Helpers/DisposableDirectory.cs
raw symbols SCIP| 1 | // Copyright (c) .NET Foundation. All rights reserved. |
| 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 3 | |
| 4 | using System; |
| 5 | using System.IO; |
| 6 | |
| 7 | namespace Microsoft.NuGet.Build.Tasks.Tests.Helpers |
| 8 | { |
| 9 | public sealed class DisposableDirectory : TempDirectory, IDisposable |
| 10 | { |
| 11 | public DisposableDirectory(TempRoot root) |
| 12 | : base(root) |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | public void Dispose() |
| 17 | { |
| 18 | if (Path != null && Directory.Exists(Path)) |
| 19 | { |
| 20 | Directory.Delete(Path, recursive: true); |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 | } |