Fix: set directory of application for directory of the ini-file.

This commit is contained in:
Gerhard Hoffmann 2023-12-13 13:38:34 +01:00
parent e87456f26b
commit 1e379cf086

View File

@ -87,7 +87,7 @@ void CommandLineParser::configure() {
m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann"); m_repositoryUrlOption.setDefaultValue("https://git.mimbach49.de/GerhardHoffmann");
m_parser.addOption(m_repositoryUrlOption); m_parser.addOption(m_repositoryUrlOption);
m_iniFileDirectoryOption.setDefaultValue("."); m_iniFileDirectoryOption.setDefaultValue(QCoreApplication::applicationDirPath());
m_parser.addOption(m_iniFileDirectoryOption); m_parser.addOption(m_iniFileDirectoryOption);
m_iniFileNameOption.setDefaultValue("ATBUpdateTool.ini"); m_iniFileNameOption.setDefaultValue("ATBUpdateTool.ini");
@ -117,10 +117,10 @@ void CommandLineParser::configure() {
m_extendedVersionOption.setDefaultValue("false"); m_extendedVersionOption.setDefaultValue("false");
m_parser.addOption(m_extendedVersionOption); m_parser.addOption(m_extendedVersionOption);
m_yoctoVersionOption .setDefaultValue("false"); m_yoctoVersionOption.setDefaultValue("false");
m_parser.addOption(m_yoctoVersionOption); m_parser.addOption(m_yoctoVersionOption);
m_yoctoInstallStatusOption .setDefaultValue("false"); m_yoctoInstallStatusOption.setDefaultValue("false");
m_parser.addOption(m_yoctoInstallStatusOption); m_parser.addOption(m_yoctoInstallStatusOption);
} }
@ -128,7 +128,6 @@ void CommandLineParser::readSettings() {
QString const iniFileDir = m_parser.value(m_iniFileDirectoryOption); QString const iniFileDir = m_parser.value(m_iniFileDirectoryOption);
QString const iniFileName = m_parser.value(m_iniFileNameOption); QString const iniFileName = m_parser.value(m_iniFileNameOption);
m_iniFileName = QDir::cleanPath(iniFileDir + QDir::separator() + iniFileName); m_iniFileName = QDir::cleanPath(iniFileDir + QDir::separator() + iniFileName);
if (!m_iniFileName.isEmpty()) { if (!m_iniFileName.isEmpty()) {
if (QFile(m_iniFileName).exists()) { if (QFile(m_iniFileName).exists()) {
QSettings settings(m_iniFileName, QSettings::IniFormat); QSettings settings(m_iniFileName, QSettings::IniFormat);