public override bool Start() { #region Set EXE file path if (this.IsRubyInPath) { this.RubyPath = FindInPath.Find("ruby.exe", MainWindow.WorkingDirectory, false); this.SassPath = FindInPath.Find("sass", MainWindow.WorkingDirectory, true, true); if (SassPath.EndsWith(".bat", StringComparison.OrdinalIgnoreCase) || SassPath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase) || SassPath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase)) { HashSet <string> possibleSassLocations = FindPathInfo.InBat("\"ruby.exe\"", "sass\"", SassPath); if (possibleSassLocations != null) { foreach (string possibleSassLocation in possibleSassLocations) { string temp = possibleSassLocation.Replace("\"", "").Replace("ruby.exe ", ""); if (File.Exists(temp)) { SassPath = temp; break; } } } } } fileName = RubyPath; arguments = "-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) \"" + PathConverter.ConvertWinToUnix(SassPath) + "\""; #endregion #region Merge paths InputPath = !String.IsNullOrEmpty(InputPath) ? PathConverter.ConvertUnixToWin(InputPath) : "."; if (Directory.Exists(InputPath)) { if (InputPath[InputPath.Length - 1] != '\\') { InputPath += '\\'; } } if (Directory.Exists(OutputPath)) { if (OutputPath[OutputPath.Length - 1] != '\\') { OutputPath += '\\'; } } if (String.IsNullOrEmpty(OutputPath)) { workingDirectory = Path.GetDirectoryName(InputPath); InputPath = PathConverter.ConvertWinToUnix(Path.GetFileName(InputPath)); OutputPath = PathConverter.ConvertWinToUnix(Path.GetFileName(OutputPath)); } else { workingDirectory = ComparePath.Compare(InputPath, OutputPath, '\\'); int headerIndex = workingDirectory.Length; InputPath = PathConverter.ConvertWinToUnix(InputPath.Substring(headerIndex)); OutputPath = PathConverter.ConvertWinToUnix(OutputPath.Substring(headerIndex)); } if (String.IsNullOrEmpty(InputPath)) { InputPath = "."; } if (String.IsNullOrEmpty(OutputPath)) { OutputPath = "."; } #endregion #region Set arguments fileName = this.RubyPath; arguments += " " + this.AddParams; if (!String.IsNullOrEmpty(CodeStyle)) { arguments += " --style " + CodeStyle; } if (this.IsUseLF) { arguments += " --unix-newlines"; } if (!this.IsWatch && this.IsForce) { arguments += " --force"; } if (this.IsNoCache) { arguments += " --no-cache"; } if (this.IsWatch) { arguments += " --watch " + this.InputPath + ":" + this.OutputPath; } else { arguments += " --update " + this.InputPath + ":" + this.OutputPath; } #endregion #region Set process properties setupInfo(fileName, arguments, workingDirectory); return(run()); #endregion }
public override bool Start() { #region Set exe files path if (this.IsNodeInPath) { this.NodeJsPath = FindInPath.Find("node.exe", MainWindow.WorkingDirectory, false); } if (this.IsCoffeeGlobal) { CoffeePath = FindInPath.Find("coffee", MainWindow.WorkingDirectory, true, false); if (CoffeePath.EndsWith(".bat", StringComparison.OrdinalIgnoreCase) || CoffeePath.EndsWith(".cmd", StringComparison.OrdinalIgnoreCase) || CoffeePath.EndsWith(".com", StringComparison.OrdinalIgnoreCase)) { HashSet <string> possibleCoffeeLocations = FindPathInfo.InBat("%~dp0\\.\\", "coffee", CoffeePath); if (possibleCoffeeLocations != null) { foreach (string possibleCoffeeLocation in possibleCoffeeLocations) { string temp = possibleCoffeeLocation.Replace("%~dp0\\.\\", string.Empty); string tempFullPath = Path.GetDirectoryName(CoffeePath) + Path.DirectorySeparatorChar + temp; if (File.Exists(tempFullPath)) { CoffeePath = tempFullPath; break; } } } } ; } fileName = this.NodeJsPath; arguments = "\"" + PathConverter.ConvertWinToUnix(this.CoffeePath) + "\""; #endregion #region Merge paths InputPath = !String.IsNullOrEmpty(InputPath) ? PathConverter.ConvertUnixToWin(InputPath) : "."; if (Directory.Exists(InputPath)) { if (InputPath[InputPath.Length - 1] != '\\') { InputPath += '\\'; } } if (Directory.Exists(OutputPath)) { if (OutputPath[OutputPath.Length - 1] != '\\') { OutputPath += '\\'; } } if (String.IsNullOrEmpty(OutputPath)) { workingDirectory = Path.GetDirectoryName(InputPath); InputPath = PathConverter.ConvertWinToUnix(Path.GetFileName(InputPath)); OutputPath = PathConverter.ConvertWinToUnix(Path.GetFileName(OutputPath)); } else { workingDirectory = ComparePath.Compare(InputPath, OutputPath, '\\'); int headerIndex = workingDirectory.Length; InputPath = PathConverter.ConvertWinToUnix(InputPath.Substring(headerIndex)); OutputPath = PathConverter.ConvertWinToUnix(OutputPath.Substring(headerIndex)); } if (String.IsNullOrEmpty(InputPath)) { InputPath = "."; } if (String.IsNullOrEmpty(OutputPath)) { OutputPath = "."; } #endregion #region Set arguments arguments += " " + this.AddParams; if (this.IsBare) { arguments += " --bare"; } if (this.IsWatch) { arguments += " --watch"; } arguments += " --compile"; if (!String.IsNullOrEmpty(OutputPath)) { arguments += " --output " + this.OutputPath; } arguments += " " + this.InputPath; #endregion #region Set process properties setupInfo(fileName, arguments, workingDirectory); return(run()); #endregion }