mirror of
https://github.com/deskflow/deskflow.git
synced 2026-07-07 21:07:23 +08:00
SYNERGY-835 Synergy stops working (#6975)
* SYNERGY-835 Synergy stops working * Add temporary fix of problem with missed config file * SYNERGY-835 Synergy stops working * Update ChangeLog * SYNERGY-835 Synergy stops working * Fix code smell * SYNERGY-835 Synergy stops working * Change logic of temp config generation * SYNERGY-835 Synergy stops working * Change variable name Co-authored-by: Andrii Batyiev <andrii-external@symless.com> Co-authored-by: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com>
This commit is contained in:
parent
b9433c0b74
commit
d73ce7cfbc
@ -7,6 +7,7 @@ Bug fixes:
|
||||
- #6972 Fix SonarCloud security hotspots
|
||||
- #6971 Fix vulnerabilities from SonarCloud
|
||||
- #6974 Fix macOS 10.13 application filess
|
||||
- #6975 Fix server stop working
|
||||
- #6976 Fix windows builds
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -793,31 +793,45 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
|
||||
|
||||
QString MainWindow::configFilename()
|
||||
{
|
||||
QString filename;
|
||||
QString configFullPath;
|
||||
if (appConfig().getUseExternalConfig())
|
||||
{
|
||||
filename = appConfig().getConfigFile();
|
||||
configFullPath = appConfig().getConfigFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: no need to use a temporary file, since we need it to
|
||||
// be permenant (since it'll be used for Windows services, etc).
|
||||
QTemporaryFile tempConfigFile;
|
||||
tempConfigFile.setAutoRemove(false);
|
||||
QStringList errors;
|
||||
for (auto path : {QStandardPaths::AppDataLocation,
|
||||
QStandardPaths::AppConfigLocation})
|
||||
{
|
||||
auto configDirPath = QStandardPaths::writableLocation(path);
|
||||
if (!QDir().mkpath(configDirPath))
|
||||
{
|
||||
errors.push_back(tr("Failed to create config folder \"%1\"").arg(configDirPath));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tempConfigFile.open())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Cannot write configuration file"), tr("The temporary configuration file required to start synergy can not be written."));
|
||||
return "";
|
||||
}
|
||||
QFile configFile(configDirPath + "/LastConfig.cfg");
|
||||
if (!configFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
errors.push_back(tr("File:\"%1\" Error:%2").arg(configFile.fileName(), configFile.errorString()));
|
||||
continue;
|
||||
}
|
||||
|
||||
serverConfig().save(tempConfigFile);
|
||||
filename = tempConfigFile.fileName();
|
||||
serverConfig().save(configFile);
|
||||
configFile.close();
|
||||
configFullPath = configFile.fileName();
|
||||
|
||||
tempConfigFile.close();
|
||||
break;
|
||||
}
|
||||
|
||||
if (configFullPath.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Cannot write configuration file"), errors.join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
return filename;
|
||||
return configFullPath;
|
||||
}
|
||||
|
||||
QString MainWindow::address() const
|
||||
@ -855,6 +869,10 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
|
||||
}
|
||||
|
||||
QString configFilename = this->configFilename();
|
||||
if (configFilename.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if defined(Q_OS_WIN)
|
||||
// wrap in quotes in case username contains spaces.
|
||||
configFilename = QString("\"%1\"").arg(configFilename);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user