TemporaryDirectory will deleted at the end of process, Path of NSIS is besite of base directory.

This commit is contained in:
2018-08-02 10:23:45 +02:00
parent f8ca13d7e6
commit d85858b0c1
6 changed files with 70 additions and 50 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Threading;
namespace KattekerCreator.Helper
{
public class TemporaryDirectory : IDisposable
{
public string Path { get; }
public TemporaryDirectory(string path)
{
Path = path;
}
void IDisposable.Dispose()
{
try
{
Thread.Sleep(100);
System.IO.Directory.Delete(Path, true);
}
catch
{
//ignore.
}
}
}
}