mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
remove: removed the permission check for v2ctl according to an upstream decision
This commit is contained in:
parent
42baec8bde
commit
96ab43b52c
@ -1 +1 @@
|
|||||||
6035
|
6036
|
||||||
|
@ -16,9 +16,7 @@ namespace Qv2ray::core::kernel
|
|||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
// For Linux/macOS users: if they cannot execute the core,
|
// For Linux/macOS users: if they cannot execute the core,
|
||||||
// then we shall grant the permission to execute it.
|
// then we shall grant the permission to execute it.
|
||||||
|
|
||||||
QFile coreFile(vCorePath);
|
QFile coreFile(vCorePath);
|
||||||
|
|
||||||
if (!coreFile.permissions().testFlag(QFileDevice::ExeUser))
|
if (!coreFile.permissions().testFlag(QFileDevice::ExeUser))
|
||||||
{
|
{
|
||||||
DEBUG("Core file not executable. Trying to enable.");
|
DEBUG("Core file not executable. Trying to enable.");
|
||||||
@ -26,7 +24,7 @@ namespace Qv2ray::core::kernel
|
|||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
DEBUG("Failed to enable executable permission.");
|
DEBUG("Failed to enable executable permission.");
|
||||||
const auto message = tr("Core file is lacking executable permission for the current user.") % //
|
const auto message = tr("Core file is lacking executable permission for the current user.") +
|
||||||
tr("Qv2ray tried to set, but failed because permission denied.");
|
tr("Qv2ray tried to set, but failed because permission denied.");
|
||||||
return { false, message };
|
return { false, message };
|
||||||
}
|
}
|
||||||
@ -40,40 +38,12 @@ namespace Qv2ray::core::kernel
|
|||||||
DEBUG("Core file is executable.");
|
DEBUG("Core file is executable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also do the same thing for v2ctl.
|
|
||||||
// TODO: Simplify This / Extract This Creepy Thing
|
|
||||||
const auto coreControlFilePath =
|
|
||||||
QDir::cleanPath(QFileInfo(coreFile).absoluteDir().path() + QDir::separator() + "v2ctl" QV2RAY_EXECUTABLE_SUFFIX);
|
|
||||||
|
|
||||||
QFile coreControlFile(coreControlFilePath);
|
|
||||||
if (!coreControlFile.permissions().testFlag(QFileDevice::ExeUser))
|
|
||||||
{
|
|
||||||
DEBUG("Core control file not executable. Trying to enable.");
|
|
||||||
const auto result = coreControlFile.setPermissions(coreFile.permissions().setFlag(QFileDevice::ExeUser));
|
|
||||||
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
DEBUG("Failed to enable executable permission for core control.");
|
|
||||||
const auto message = tr("Core control file is lacking executable permission for the current user.") + //
|
|
||||||
tr("Qv2ray tried to set, but failed because permission denied.");
|
|
||||||
return { false, message };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DEBUG("Core control executable permission set.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DEBUG("Core control file is executable.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return { true, std::nullopt };
|
return { true, std::nullopt };
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
// For Windows and other users: just skip this check.
|
// For Windows and other users: just skip this check.
|
||||||
DEBUG("Skipped check and set core executable state.");
|
DEBUG("Skipped check and set core executable state.");
|
||||||
return { true, tr("Check is skipped") };
|
return { true, tr("Check is skipped") };
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool V2RayKernelInstance::ValidateKernel(const QString &vCorePath, const QString &vAssetsPath, QString *message)
|
bool V2RayKernelInstance::ValidateKernel(const QString &vCorePath, const QString &vAssetsPath, QString *message)
|
||||||
|
Loading…
Reference in New Issue
Block a user