using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.InteropServices; using System.IO; using Microsoft.Dnx.Runtime.Common.CommandLine; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools.Common; namespace Microsoft.DotNet.Tools.Compiler.Native { public static class DirectoryExtensions { internal static void CleanOrCreateDirectory(string path) { if (Directory.Exists(path)) { try { Directory.Delete(path, recursive: true); Directory.CreateDirectory(path); } catch (Exception e) { Console.WriteLine("Unable to remove directory: " + path); Console.WriteLine(e.Message); } } else { Directory.CreateDirectory(path); } } } }