mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
31 lines
736 B
C#
31 lines
736 B
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace Semmle.Util
|
|
{
|
|
/// <summary>
|
|
/// A temporary directory that is created within the system temp directory.
|
|
/// When this object is disposed, the directory is deleted.
|
|
/// </summary>
|
|
public sealed class TemporaryDirectory : IDisposable
|
|
{
|
|
public DirectoryInfo DirInfo { get; }
|
|
|
|
public TemporaryDirectory(string name)
|
|
{
|
|
DirInfo = new DirectoryInfo(name);
|
|
DirInfo.Create();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
DirInfo.Delete(true);
|
|
}
|
|
|
|
public override string ToString() => DirInfo.FullName.ToString();
|
|
}
|
|
}
|