dotnet-installer/src/dotnet/commands/dotnet-compile-native/DirectoryExtensions.cs
David Fowler dfc59eb20e Everything in the same project
- Build in intrinsic commands as part of dotnet
2016-02-01 14:56:32 -08:00

38 lines
1,018 B
C#

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);
}
}
}
}