Example #1
0
        public static void UnzipArchiveCrossPlatform(IIgorModule ModuleInst, string ZipFilename, string DirectoryToUnzipTo, bool bUpdateBuildProducts = false)
        {
            IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform();

            if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX)
            {
                UnzipFileMac(ModuleInst, ZipFilename, DirectoryToUnzipTo, bUpdateBuildProducts);
            }
            else if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_Windows || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_Windows)
            {
                UnzipFileWindows(ModuleInst, ZipFilename, DirectoryToUnzipTo, bUpdateBuildProducts);
            }
        }
Example #2
0
        public static int RunProcessCrossPlatform(IIgorModule ModuleInst, string OSXCommand, string WindowsCommand, string Parameters, string Directory, string CommandLogDescription, ref string ProcessOutput, ref string ProcessError, bool bUseShell = false)
        {
            int RunProcessExitCode = RunProcessCrossPlatform(OSXCommand, WindowsCommand, Parameters, Directory, ref ProcessOutput, ref ProcessError, bUseShell);

            IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform();

            if (!IgorAssert.EnsureTrue(ModuleInst, RunProcessExitCode == 0, CommandLogDescription + " failed!\nCommand: " + (
                                           (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX) ? OSXCommand : WindowsCommand
                                           ) + " " + Parameters + "\nDirectory: " + Directory + "\nOutput:\n" + ProcessOutput + "\n\n\nError:\n" + ProcessError))
            {
                return(RunProcessExitCode);
            }

            IgorDebug.Log(ModuleInst, CommandLogDescription + " succeeded!\nOutput:\n" + ProcessOutput + "\n\n\nError:\n" + ProcessError);

            return(RunProcessExitCode);
        }
Example #3
0
        public static void ZipFilesCrossPlatform(IIgorModule ModuleInst, List <string> FilesToZip, string ZipFilename, bool bUpdateBuildProducts = true, string RootDir = ".")
        {
            if (File.Exists(ZipFilename))
            {
                IgorRuntimeUtils.DeleteFile(ZipFilename);
            }

            IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform();

            if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX)
            {
                ZipFilesMac(ModuleInst, FilesToZip, ZipFilename, bUpdateBuildProducts, RootDir);
            }
            else if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_Windows || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_Windows)
            {
                ZipFilesWindows(ModuleInst, FilesToZip, ZipFilename, bUpdateBuildProducts, RootDir);
            }
        }
Example #4
0
        public static int RunProcessCrossPlatform(string OSXCommand, string WindowsCommand, string Parameters, string Directory, ref string Output, ref string Error, bool bUseShell = false)
        {
            string Command = "";

            IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform();

            if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX)
            {
                Command = OSXCommand;
            }
            else if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_Windows || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_Windows)
            {
                Command = WindowsCommand;
            }

            Command = UpdatePathForEnvVariables(Command);

            System.Diagnostics.ProcessStartInfo NewStartInfo = new System.Diagnostics.ProcessStartInfo();
            NewStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            if (!bUseShell)
            {
                System.IO.FileInfo NewFileInfo = new System.IO.FileInfo(Command);

                NewStartInfo.FileName = NewFileInfo.FullName;
            }
            else
            {
                NewStartInfo.FileName = Command;
            }

            NewStartInfo.Arguments = Parameters;

            NewStartInfo.WorkingDirectory = "";

            if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX)
            {
                NewStartInfo.WorkingDirectory = Directory;
            }
            else if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_Windows || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_Windows)
            {
                NewStartInfo.WorkingDirectory = Directory.Replace("/", "\\");
            }

            NewStartInfo.UseShellExecute        = bUseShell;
            NewStartInfo.RedirectStandardOutput = !bUseShell;
            NewStartInfo.RedirectStandardError  = !bUseShell;

//			Debug.Log("Attempting to start process:\n" + NewStartInfo.FileName + "\nWith parameters:\n" + NewStartInfo.Arguments + "\nIn directory:\n" + NewStartInfo.WorkingDirectory);

            System.Diagnostics.Process NewProcess = System.Diagnostics.Process.Start(NewStartInfo);

            if (!bUseShell)
            {
                Output = NewProcess.StandardOutput.ReadToEnd();
                Error  = NewProcess.StandardError.ReadToEnd();
            }

            NewProcess.WaitForExit();

            return(NewProcess.ExitCode);
        }