- fix spew from QDir when not using a config file
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ make
|
||||
.git
|
||||
build
|
||||
.vscode
|
||||
test_config/slide.options.json
|
||||
|
||||
@@ -49,6 +49,11 @@ void SetJSONBool(bool &value, QJsonObject jsonDoc, const char *key) {
|
||||
}
|
||||
|
||||
Config loadConfiguration(const std::string &configFilePath, const Config ¤tConfig) {
|
||||
if(configFilePath.empty())
|
||||
{
|
||||
return currentConfig;
|
||||
}
|
||||
|
||||
QString jsonFile(configFilePath.c_str());
|
||||
QDir directory;
|
||||
if(!directory.exists(jsonFile))
|
||||
@@ -218,6 +223,11 @@ QVector<PathEntry> parsePathEntry(QJsonObject &jsonMainDoc, bool baseRecursive,
|
||||
}
|
||||
|
||||
AppConfig loadAppConfiguration(const AppConfig &commandLineConfig) {
|
||||
if(commandLineConfig.configPath.empty())
|
||||
{
|
||||
return commandLineConfig;
|
||||
}
|
||||
|
||||
QString jsonFile = getAppConfigFilePath(commandLineConfig.configPath);
|
||||
QDir directory;
|
||||
if(!directory.exists(jsonFile))
|
||||
@@ -272,6 +282,10 @@ AppConfig loadAppConfiguration(const AppConfig &commandLineConfig) {
|
||||
}
|
||||
|
||||
Config getConfigurationForFolder(const std::string &folderPath, const Config ¤tConfig) {
|
||||
if(folderPath.empty())
|
||||
{
|
||||
return currentConfig;
|
||||
}
|
||||
QDir directory(folderPath.c_str());
|
||||
QString jsonFile = directory.filePath(QString("options.json"));
|
||||
if(directory.exists(jsonFile))
|
||||
|
||||
@@ -210,6 +210,11 @@ std::unique_ptr<ImageSelector> GetSelectorForApp(const AppConfig& appConfig)
|
||||
|
||||
void ReloadConfigIfNeeded(AppConfig &appConfig, MainWindow &w, ImageSwitcher *switcher)
|
||||
{
|
||||
if(appConfig.configPath.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString jsonFile = getAppConfigFilePath(appConfig.configPath);
|
||||
QDir directory;
|
||||
if(!directory.exists(jsonFile))
|
||||
|
||||
Reference in New Issue
Block a user