mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
changed using cp to QFile to copy wireguard config
This commit is contained in:
@@ -37,7 +37,6 @@ private:
|
|||||||
|
|
||||||
QSharedPointer<PrivilegedProcess> m_wireguardStartProcess;
|
QSharedPointer<PrivilegedProcess> m_wireguardStartProcess;
|
||||||
QSharedPointer<PrivilegedProcess> m_wireguardStopProcess;
|
QSharedPointer<PrivilegedProcess> m_wireguardStopProcess;
|
||||||
IpcClient *m_ipcClient;
|
|
||||||
|
|
||||||
bool m_isConfigLoaded = false;
|
bool m_isConfigLoaded = false;
|
||||||
|
|
||||||
|
|||||||
@@ -129,20 +129,17 @@ void IpcServer::setLogsEnabled(bool enabled)
|
|||||||
bool IpcServer::copyWireguardConfig(const QString &sourcePath)
|
bool IpcServer::copyWireguardConfig(const QString &sourcePath)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
QProcess copyWireguardConfigProcess;
|
const QString wireguardConfigPath = "/etc/wireguard/wg99.conf";
|
||||||
|
if (QFile::exists(wireguardConfigPath))
|
||||||
|
{
|
||||||
|
QFile::remove(wireguardConfigPath);
|
||||||
|
}
|
||||||
|
|
||||||
bool errorOccurred = false;
|
if (!QFile::copy(sourcePath, wireguardConfigPath)) {
|
||||||
|
qDebug() << "WireguardProtocol::WireguardProtocol error occured while copying wireguard config:";
|
||||||
connect(©WireguardConfigProcess, &QProcess::errorOccurred, this, [&errorOccurred](QProcess::ProcessError error) {
|
return false;
|
||||||
qDebug() << "WireguardProtocol::WireguardProtocol error occured while copying wireguard config: " << error;
|
}
|
||||||
errorOccurred = true;
|
return true;
|
||||||
});
|
|
||||||
|
|
||||||
copyWireguardConfigProcess.setProgram("/bin/cp");
|
|
||||||
copyWireguardConfigProcess.setArguments(QStringList{sourcePath, "/etc/wireguard/wg99.conf"});
|
|
||||||
copyWireguardConfigProcess.start();
|
|
||||||
copyWireguardConfigProcess.waitForFinished(10000);
|
|
||||||
return errorOccurred;
|
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user