mirror of https://github.com/dotnet/tye.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
651 B
27 lines
651 B
using System;
|
|
using System.IO;
|
|
|
|
namespace Tye
|
|
{
|
|
internal class TempDirectory : IDisposable
|
|
{
|
|
public static TempDirectory Create()
|
|
{
|
|
var directoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
|
Directory.CreateDirectory(directoryPath);
|
|
return new TempDirectory(directoryPath);
|
|
}
|
|
|
|
private TempDirectory(string directoryPath)
|
|
{
|
|
DirectoryPath = directoryPath;
|
|
}
|
|
|
|
public string DirectoryPath { get; }
|
|
|
|
public void Dispose()
|
|
{
|
|
Directory.Delete(DirectoryPath, recursive: true);
|
|
}
|
|
}
|
|
}
|
|
|