diff options
author | MacDue <macdue@dueutil.tech> | 2023-03-14 19:57:51 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-24 22:06:38 +0000 |
commit | b3edd83e0a5c1f32509706ae2e33d6a73f29b903 (patch) | |
tree | 96ea3afda16c292f3f2d020f54fe0ac59326683a /Userland/Libraries/LibGUI | |
parent | 62e8360dcf1b4ecf90f4c8c35852ed1ffd200e4f (diff) | |
download | serenity-b3edd83e0a5c1f32509706ae2e33d6a73f29b903.zip |
LibGUI: Allow passing working directory to spawn_or_show_error()
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/Process.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Process.h | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Libraries/LibGUI/Process.cpp b/Userland/Libraries/LibGUI/Process.cpp index 269a6a3a9b..3029fb2251 100644 --- a/Userland/Libraries/LibGUI/Process.cpp +++ b/Userland/Libraries/LibGUI/Process.cpp @@ -9,28 +9,28 @@ #include <LibGUI/Process.h> template<typename StringType> -void spawn_or_show_error(GUI::Window* parent_window, StringView path, ReadonlySpan<StringType> arguments) +void spawn_or_show_error(GUI::Window* parent_window, StringView path, ReadonlySpan<StringType> arguments, StringView working_directory) { - auto spawn_result = Core::Process::spawn(path, arguments); + auto spawn_result = Core::Process::spawn(path, arguments, working_directory); if (spawn_result.is_error()) GUI::MessageBox::show_error(parent_window, DeprecatedString::formatted("Failed to spawn {}: {}", path, spawn_result.error())); } namespace GUI { -void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<DeprecatedString> arguments) +void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<DeprecatedString> arguments, StringView working_directory) { - ::spawn_or_show_error<DeprecatedString>(parent_window, path, arguments); + ::spawn_or_show_error<DeprecatedString>(parent_window, path, arguments, working_directory); } -void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<StringView> arguments) +void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<StringView> arguments, StringView working_directory) { - ::spawn_or_show_error<StringView>(parent_window, path, arguments); + ::spawn_or_show_error<StringView>(parent_window, path, arguments, working_directory); } -void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<char const*> arguments) +void Process::spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<char const*> arguments, StringView working_directory) { - ::spawn_or_show_error<char const*>(parent_window, path, arguments); + ::spawn_or_show_error<char const*>(parent_window, path, arguments, working_directory); } } diff --git a/Userland/Libraries/LibGUI/Process.h b/Userland/Libraries/LibGUI/Process.h index 8ba1aa8eef..44a5969077 100644 --- a/Userland/Libraries/LibGUI/Process.h +++ b/Userland/Libraries/LibGUI/Process.h @@ -12,9 +12,9 @@ namespace GUI { struct Process { - static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<DeprecatedString> arguments); - static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<StringView> arguments); - static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<char const*> arguments = {}); + static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<DeprecatedString> arguments, StringView working_directory = {}); + static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<StringView> arguments, StringView working_directory = {}); + static void spawn_or_show_error(Window* parent_window, StringView path, ReadonlySpan<char const*> arguments = {}, StringView working_directory = {}); }; } |