mirror of
https://github.com/bitwarden/server.git
synced 2025-05-17 17:45:36 -05:00

* Revert "Add git blame entry (#2226)" This reverts commit 239286737d15cb84a893703ee5a8b33a2d67ad3d. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit 34fb4cca2aa78deb84d4cbc359992a7c6bba7ea5.
40 lines
889 B
C#
40 lines
889 B
C#
namespace Bit.Core.Test
|
|
{
|
|
public class TempDirectory : IDisposable
|
|
{
|
|
public string Directory { get; private set; }
|
|
|
|
public TempDirectory()
|
|
{
|
|
Directory = Path.Combine(Path.GetTempPath(), $"bitwarden_{Guid.NewGuid().ToString().Replace("-", "")}");
|
|
}
|
|
|
|
public override string ToString() => Directory;
|
|
|
|
#region IDisposable implementation
|
|
~TempDirectory()
|
|
{
|
|
Dispose(false);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Dispose(true);
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
public void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
try
|
|
{
|
|
System.IO.Directory.Delete(Directory, true);
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
# endregion
|
|
}
|
|
}
|