From 40e1f6b8ae11c2089acfe291f5a453688eefa806 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Wed, 1 Sep 2021 08:31:42 -0700 Subject: [PATCH] Change LinuxBSD's shell_open to work on additional calls --- platform/linuxbsd/os_linuxbsd.cpp | 32 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 2c9801f51204..ef5765895e19 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -188,40 +188,36 @@ String OS_LinuxBSD::get_name() const { } Error OS_LinuxBSD::shell_open(String p_uri) { - Error ok; - int err_code; + Error err; List args; args.push_back(p_uri); // Agnostic - ok = execute("xdg-open", args, nullptr, &err_code); - if (ok == OK && !err_code) { + err = create_process("xdg-open", args); + if (err == OK) { return OK; - } else if (err_code == 2) { - return ERR_FILE_NOT_FOUND; } // GNOME args.push_front("open"); // The command is `gio open`, so we need to add it to args - ok = execute("gio", args, nullptr, &err_code); - if (ok == OK && !err_code) { + err = create_process("gio", args); + if (err == OK) { return OK; - } else if (err_code == 2) { - return ERR_FILE_NOT_FOUND; } args.pop_front(); - ok = execute("gvfs-open", args, nullptr, &err_code); - if (ok == OK && !err_code) { + err = create_process("gvfs-open", args); + if (err == OK) { return OK; - } else if (err_code == 2) { - return ERR_FILE_NOT_FOUND; } // KDE - ok = execute("kde-open5", args, nullptr, &err_code); - if (ok == OK && !err_code) { + err = create_process("kde-open5", args); + if (err == OK) { + return OK; + } + err = create_process("kde-open", args); + if (err == OK) { return OK; } - ok = execute("kde-open", args, nullptr, &err_code); - return !err_code ? ok : FAILED; + return FAILED; } bool OS_LinuxBSD::_check_internal_feature_support(const String &p_feature) {