Esempio n. 1
0
        private static ProcessStartInfo GetJamStartInfo(bool includeModules)
        {
            StringBuilder moduleArgs = new StringBuilder();

            moduleArgs.Append("jam.pl LiveReloadableEditorAssemblies " + InternalEditorUtility.GetBuildSystemVariationArgs());
            if (includeModules)
            {
                foreach (string target in ModuleManager.GetJamTargets())
                {
                    moduleArgs.Append(" ").Append(target);
                }
            }

            var psi = new ProcessStartInfo
            {
                WorkingDirectory       = Unsupported.GetBaseUnityDeveloperFolder(),
                RedirectStandardOutput = true,
                RedirectStandardError  = false,
                //The only reason jam.pl exists is that I cannot figure out how to call jam.bat, or jam.exe directly. magic.
                Arguments = moduleArgs.ToString(),
                FileName  = "perl",
            };

            var path = Environment.GetEnvironmentVariable("PATH") ?? "";

            // on macOS the typical mercurial path might not be in our environment variable, so add it for executing jam
            if (Application.platform == RuntimePlatform.OSXEditor)
            {
                var localBin = "/usr/local/bin";
                if (!path.Contains(localBin))
                {
                    path = $"{path}:{localBin}";
                }
            }
            psi.EnvironmentVariables["PATH"] = path;

            return(psi);
        }