Update to the latest Platform::CreateProcess

This commit is contained in:
Wojtek Figat
2023-03-22 14:18:52 +01:00
parent c31e4023c4
commit 7d4bf8356e
11 changed files with 103 additions and 32 deletions

View File

@@ -9,6 +9,7 @@
#include "Engine/Engine/Globals.h"
#include "Engine/Core/Collections/Sorting.h"
#include "Engine/Platform/File.h"
#include "Engine/Platform/CreateProcessSettings.h"
#include "Engine/Serialization/Json.h"
#if PLATFORM_WINDOWS
@@ -242,8 +243,14 @@ void RiderCodeEditor::OpenFile(const String& path, int32 line)
// Open file
line = line > 0 ? line : 1;
const String args = String::Format(TEXT("\"{0}\" --line {2} \"{1}\""), _solutionPath, path, line);
Platform::StartProcess(_execPath, args, StringView::Empty);
CreateProcessSettings procSettings;
procSettings.FileName = _execPath;
procSettings.Arguments = String::Format(TEXT("\"{0}\" --line {2} \"{1}\""), _solutionPath, path, line);
procSettings.HiddenWindow = false;
procSettings.WaitForEnd = false;
procSettings.LogOutput = false;
procSettings.ShellExecute = true;
Platform::CreateProcess(procSettings);
}
void RiderCodeEditor::OpenSolution()
@@ -255,8 +262,14 @@ void RiderCodeEditor::OpenSolution()
}
// Open solution
const String args = String::Format(TEXT("\"{0}\""), _solutionPath);
Platform::StartProcess(_execPath, args, StringView::Empty);
CreateProcessSettings procSettings;
procSettings.FileName = _execPath;
procSettings.Arguments = String::Format(TEXT("\"{0}\""), _solutionPath);
procSettings.HiddenWindow = false;
procSettings.WaitForEnd = false;
procSettings.LogOutput = false;
procSettings.ShellExecute = true;
Platform::CreateProcess(procSettings);
}
void RiderCodeEditor::OnFileAdded(const String& path)

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
#include "SystemDefaultCodeEditor.h"
#include "Engine/Core/Types/StringView.h"
#include "Engine/Platform/CreateProcessSettings.h"
CodeEditorTypes SystemDefaultCodeEditor::GetType() const
{
@@ -15,7 +15,13 @@ String SystemDefaultCodeEditor::GetName() const
void SystemDefaultCodeEditor::OpenFile(const String& path, int32 line)
{
Platform::StartProcess(path, StringView::Empty, StringView::Empty);
CreateProcessSettings procSettings;
procSettings.FileName = path;
procSettings.HiddenWindow = false;
procSettings.WaitForEnd = false;
procSettings.LogOutput = false;
procSettings.ShellExecute = true;
Platform::CreateProcess(procSettings);
}
void SystemDefaultCodeEditor::OpenSolution()

View File

@@ -2,14 +2,16 @@
#include "VisualStudioCodeEditor.h"
#include "Engine/Platform/FileSystem.h"
#include "Engine/Platform/CreateProcessSettings.h"
#include "Engine/Core/Log.h"
#include "Editor/Editor.h"
#include "Editor/ProjectInfo.h"
#include "Editor/Scripting/ScriptsBuilder.h"
#include "Engine/Engine/Globals.h"
#include "Engine/Platform/Win32/IncludeWindowsHeaders.h"
#if PLATFORM_LINUX
#include <stdio.h>
#elif PLATFORM_WINDOWS
#include "Engine/Platform/Win32/IncludeWindowsHeaders.h"
#elif PLATFORM_MAC
#include "Engine/Platform/Apple/AppleUtils.h"
#include <AppKit/AppKit.h>
@@ -140,8 +142,14 @@ void VisualStudioCodeEditor::OpenFile(const String& path, int32 line)
// Open file
line = line > 0 ? line : 1;
const String args = String::Format(TEXT("\"{0}\" -g \"{1}\":{2}"), _workspacePath, path, line);
Platform::StartProcess(_execPath, args, StringView::Empty);
CreateProcessSettings procSettings;
procSettings.FileName = _execPath;
procSettings.Arguments = String::Format(TEXT("\"{0}\" -g \"{1}\":{2}"), _workspacePath, path, line);
procSettings.HiddenWindow = false;
procSettings.WaitForEnd = false;
procSettings.LogOutput = false;
procSettings.ShellExecute = true;
Platform::CreateProcess(procSettings);
}
void VisualStudioCodeEditor::OpenSolution()
@@ -160,8 +168,14 @@ void VisualStudioCodeEditor::OpenSolution()
}
// Open solution
const String args = String::Format(TEXT("\"{0}\""), _workspacePath);
Platform::StartProcess(_execPath, args, StringView::Empty);
CreateProcessSettings procSettings;
procSettings.FileName = _execPath;
procSettings.Arguments = String::Format(TEXT("\"{0}\""), _workspacePath);
procSettings.HiddenWindow = false;
procSettings.WaitForEnd = false;
procSettings.LogOutput = false;
procSettings.ShellExecute = true;
Platform::CreateProcess(procSettings);
}
bool VisualStudioCodeEditor::UseAsyncForOpen() const