private void SetFolder(string path)
{
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
DirectoryInfo TheFolder = new DirectoryInfo(path);
if (TheFolder.GetDirectories() != null)
foreach (DirectoryInfo NextDir in TheFolder.GetDirectories())
{
try
{
Directory.Delete(NextDir.FullName);
}
catch (Exception e)
{
//Log.WriteLine(e.Message);
//var errorCode = Marshal.GetHRForException(e) & ((1 << 16) - 1);
//if (errorCode == 32 || errorCode == 33)
// Log.WriteLine("Don't worry. Everything is fine!");
}
}
if (TheFolder.GetFiles() != null)
foreach (FileInfo NextFile in TheFolder.GetFiles())
{
try
{
if (!(NextFile.FullName.EndsWith(StraboParameters.sourceMapFileName) || NextFile.FullName.EndsWith("gitkeep") || NextFile.FullName.EndsWith("log.txt") || NextFile.FullName.EndsWith(StraboParameters.sourceMapFileName)))
{
File.Delete(NextFile.FullName);
}
}
catch (Exception e)
{
Log.WriteLine(e.Message);
var errorCode = Marshal.GetHRForException(e) & ((1 << 16) - 1);
if (errorCode == 32 || errorCode == 33)
Log.WriteLine("Don't worry. Everything is fine!");
}
}
}