Files
UnrealEngineUWP/Engine/Extras/P4VUtils/ProcessUtils.cs
paul chipchase 112f017f85 [P4VUtils] Add a new command to open jira issues tagged in a changelist description in the callers web browser.
#preflight 645cc6062965f6ea8e8318cb

- Add a new command 'OpenJiraCommand' which will attempt to open jira in the users web browser to any issue tagged in that changelists description via the '#jira' tag.
-- We assume that the issue name will be Project-IssueNumber, where the project can contain both letters and numbers. The jira standard enforces that the first character of the project name cannot be a number but we have not enforced that in our checks for simplicity.
-- If multiple issues are tagged we should be able to match with them, even if they are on the same line and/or separated with ' ', ',' or '+'
-- If no tags are found we inform the user via a popup message.
-- We now have an entry in the ini file for the jira server.

- Added a new CommandCategory named 'Browser' to be used by commands that attempt to open new pages in the users web browser.
-- Moved the existing OpenPreflightCommand and RobomergePreviewCommand commands there.
-- It could be argued that PreflightCommand should be moved to 'Browser' too but it feels more at home under 'Horde'
- A number of commands were copy/pasting the code to open a path in a new process (given that the syntax is slightly different per platform) so this code has been moved to a shared ProcessUtils class.

[CL 25426132 by paul chipchase in ue5-main branch]
2023-05-11 09:43:58 -04:00

34 lines
930 B
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace P4VUtils
{
public static class ProcessUtils
{
/// <summary>
/// Opens the given path in a new process. Which process is launched
/// will be decided by the OS based on association with the Path itself.
/// A .txt file will probably open a text editor, a url will open the
/// default browser etc.
/// </summary>
/// <param name="Path"The path to be opened></param>
public static void OpenInNewProcess(string Path)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Process.Start(new ProcessStartInfo(Path) { UseShellExecute = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", Path);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", Path);
}
}
}
}