using System; using System.Diagnostics; using System.IO; using System.Text; using Directory = TeaBox.Directory; /// /// Utility to manipulate Cygwin /// internal static class Cygwin { public const string CygwinExePath = @"C:\Cygwin"; public static string ConvertToCygPath(string pathToConvert) { if (!Directory.Exists(CygwinExePath)) { return string.Empty; } var process = new Process { StartInfo = new ProcessStartInfo { FileName = Path.Combine(CygwinExePath, "bin", "cygpath.exe"), Arguments = $"-u \"{pathToConvert}\"", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = false } }; process.Start(); var builder = new StringBuilder(); while (!process.StandardOutput.EndOfStream) { builder.Append(process.StandardOutput.ReadToEnd().TrimEnd(Environment.NewLine.ToCharArray())); } return builder.ToString(); } }