private void OnInstallPathGUI() { string gitExecPath = null; string extension = null; string gitInstallPath = null; if (Environment != null) { extension = Environment.ExecutableExtension; gitInstallPath = Environment.GitInstallPath; if (Environment.GitExecutablePath != null) { gitExecPath = Environment.GitExecutablePath.ToString(); } } // Install path GUILayout.Label(GitInstallTitle, EditorStyles.boldLabel); GUI.enabled = !busy && gitExecPath != null; // Install path field EditorGUI.BeginChangeCheck(); { //TODO: Verify necessary value for a non Windows OS Styles.PathField(ref gitExecPath, () => EditorUtility.OpenFilePanel(GitInstallBrowseTitle, gitInstallPath, extension), ValidateGitInstall); } if (EditorGUI.EndChangeCheck()) { Environment.GitExecutablePath = gitExecPath.ToNPath(); } GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); GUILayout.BeginHorizontal(); { // Find button - for attempting to locate a new install if (GUILayout.Button(GitInstallFindButton, GUILayout.ExpandWidth(false))) { var task = new ProcessTask <NPath>(Manager.CancellationToken, new FirstLineIsPathOutputProcessor()) .Configure(Manager.ProcessManager, Environment.IsWindows ? "where" : "which", "git") .FinallyInUI((success, ex, path) => { if (success && !string.IsNullOrEmpty(path)) { Environment.GitExecutablePath = path; GUIUtility.keyboardControl = GUIUtility.hotControl = 0; } }); } } GUILayout.EndHorizontal(); GUI.enabled = true; }
public GitInstallationState ValidateGitLfsVersion(GitInstallationState state) { if (!state.GitLfsExecutablePath.IsInitialized || !state.GitLfsExecutablePath.FileExists()) { state.GitLfsIsValid = false; return(state); } var version = new ProcessTask <TheVersion>(cancellationToken, "version", new LfsVersionOutputProcessor()) .Configure(processManager, state.GitLfsExecutablePath, dontSetupGit: true) .Catch(e => true) .RunSynchronously(); state.GitLfsIsValid = version >= Constants.MinimumGitLfsVersion; state.GitLfsVersion = version; return(state); }
public IProcess RunCommandLineWindow(string workingDirectory) { var shell = environment.IsWindows ? "cmd" : environment.IsMac ? "xterm" : "sh"; var startInfo = new ProcessStartInfo(shell) { RedirectStandardInput = false, RedirectStandardOutput = false, RedirectStandardError = false, UseShellExecute = false, CreateNoWindow = false }; gitEnvironment.Configure(startInfo, workingDirectory); var p = new ProcessTask <string>(cancellationToken); p.Configure(startInfo); return(p); }