public static void Run(string sourcePath, string importPath, string outputPath, string standardOutputFilePath, string standardErrorFilePath) { //PapyrusCompiler seems to require that paths don't start with . and that only forward slashes are used. sourcePath = sourcePath.Trim('.', Path.DirectorySeparatorChar).Replace("\\", "/"); importPath = importPath.Trim('.', Path.DirectorySeparatorChar).Replace("\\", "/"); outputPath = outputPath.Trim('.', Path.DirectorySeparatorChar).Replace("\\", "/"); standardOutputFilePath = standardOutputFilePath.Trim('.', Path.DirectorySeparatorChar).Replace("\\", "/"); string compilerDirectory = DataDirectory.GetCompilerDirectoryPath(); string compilerPath = compilerDirectory + "PapyrusCompiler.exe"; string flagsPath = compilerDirectory.Replace("\\", "/") + "TESV_Papyrus_Flags.flg"; bool isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT; string fileName = (isWindows ? "\"" : "") + "." + Path.DirectorySeparatorChar + compilerPath + (isWindows ? "\"" : ""); string arguments = "\"" + sourcePath + "\" -f=\"" + flagsPath + "\" -i=\"" + importPath + "\" -o=\"" + outputPath + "\" -a"; Console.WriteLine("Executing PapyrusCompiler.exe: " + fileName + " " + arguments); ProcessStart(fileName, arguments, standardOutputFilePath, standardErrorFilePath); Console.WriteLine("PapyrusCompiler.exe Complete"); }
protected bool PreExecutionChecks(bool requireESM, bool requireBuildTargets, bool requireGraph, bool requireCompiler) { if (requireESM) { string esmPath = DataDirectory.GetESMDefaultFilePath(); if (!File.Exists(esmPath)) { Console.WriteLine("Please add " + esmPath); return(false); } } if (requireBuildTargets) { string buildTargetsPath = DataDirectory.GetBuildTargetsPath(); if (!Directory.Exists(buildTargetsPath)) { Console.WriteLine("Please add " + buildTargetsPath + " with all of its contents."); return(false); } } if (requireGraph) { string graphPath = DataDirectory.GetGraphDirectoryPath(); if (!Directory.Exists(graphPath)) { Console.WriteLine("Please add " + graphPath + " by running " + BuildInteroperableCompilationGraphs.FriendlyNameConst + "."); return(false); } } if (requireCompiler) { string compilerPath = DataDirectory.GetCompilerDirectoryPath(); if (!Directory.Exists(compilerPath)) { Console.WriteLine("Please add compiler binaries to " + compilerPath + "."); return(false); } } Directory.CreateDirectory(DataDirectory.GetBuildPath()); return(true); }