mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
35 lines
695 B
C#
35 lines
695 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Wabbajack.Paths.IO
|
|
{
|
|
public struct TemporaryPath : IDisposable, IAsyncDisposable
|
|
{
|
|
public readonly AbsolutePath Path { get; init; }
|
|
|
|
public TemporaryPath(AbsolutePath path)
|
|
{
|
|
Path = path;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Path.Delete();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Path.ToString();
|
|
}
|
|
|
|
public static implicit operator AbsolutePath(TemporaryPath tp)
|
|
{
|
|
return tp.Path;
|
|
}
|
|
|
|
public async ValueTask DisposeAsync()
|
|
{
|
|
Path.Delete();
|
|
}
|
|
}
|
|
} |