common find_executable function
This commit is contained in:
@@ -11,6 +11,7 @@ add_executable(wivrn-dashboard
|
||||
wivrn_server.cpp
|
||||
wivrn_qdbus_types.cpp
|
||||
apps.cpp
|
||||
dashboard_utils.cpp
|
||||
escape_string.cpp
|
||||
settings.cpp
|
||||
rectangle_partitionner.cpp
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dashboard_utils.h"
|
||||
|
||||
#include "utils/flatpak.h"
|
||||
#include <QStandardPaths>
|
||||
|
||||
QString find_executable(const QString & name)
|
||||
{
|
||||
if (wivrn::is_flatpak())
|
||||
return QStandardPaths::findExecutable(
|
||||
name,
|
||||
QStringList({"/run/host/usr/sbin", "/run/host/usr/bin", "/run/host/sbin", "/run/host/bin"}));
|
||||
return QStandardPaths::findExecutable(name);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
QString find_executable(const QString & name);
|
||||
+3
-14
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "firewall.h"
|
||||
|
||||
#include "dashboard_utils.h"
|
||||
#include "escape_sandbox.h"
|
||||
#include "utils/flatpak.h"
|
||||
#include "wivrn_config.h"
|
||||
@@ -26,7 +27,6 @@
|
||||
#include <QDBusMetaType>
|
||||
#include <QDBusReply>
|
||||
#include <QDebug>
|
||||
#include <QStandardPaths>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
@@ -171,19 +171,8 @@ std::unique_ptr<firewall::Impl> make_impl()
|
||||
if (auto fwd = std::make_unique<firewalld>(); fwd->enabled())
|
||||
return fwd;
|
||||
|
||||
if (wivrn::is_flatpak())
|
||||
{
|
||||
if (not QStandardPaths::findExecutable(
|
||||
"ufw",
|
||||
QStringList({"/run/host/usr/sbin", "/run/host/usr/bin"}))
|
||||
.isEmpty())
|
||||
return std::make_unique<ufw>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (not QStandardPaths::findExecutable("ufw").isEmpty())
|
||||
return std::make_unique<ufw>();
|
||||
}
|
||||
if (not find_executable("ufw").isEmpty())
|
||||
return std::make_unique<ufw>();
|
||||
|
||||
return std::make_unique<firewall::Impl>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user