diff --git a/src/Application.cpp b/src/Application.cpp index d181e03b..17978137 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -1,6 +1,7 @@ #include "Application.hpp" #include +#include #include #include @@ -237,13 +238,28 @@ namespace Bloom auto configFile = QFile(QString::fromStdString(Paths::projectConfigPath())); if (!configFile.exists()) { - throw InvalidConfig("Bloom configuration file (bloom.yaml) not found. Working directory: " - + Paths::projectDirPath()); + // Try looking for the old bloom.json config file + configFile.setFileName(QString::fromStdString(Paths::projectDirPath()) + "/bloom.json"); + + if (configFile.exists()) { + Logger::warning( + "The recommended project configuration file format changed from JSON to YAML in Bloom v0.11.0." + " Bloom could not find a bloom.yaml configuration file, but did find bloom.json. Please convert" + " bloom.json to YAML format and rename to \"bloom.yaml\". There are numerous online JSON -> YAML" + " converters. For now, bloom.json will be used in the absence of bloom.yaml." + ); + + } else { + throw InvalidConfig( + "Bloom configuration file (bloom.yaml) not found. Working directory: " + Paths::projectDirPath() + ); + } } if (!configFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - throw InvalidConfig("Failed to open Bloom configuration file (bloom.yaml) Working directory: " - + Paths::projectDirPath()); + throw InvalidConfig( + "Failed to open Bloom configuration file. Working directory: " + Paths::projectDirPath() + ); } const auto configNode = YAML::Load(configFile.readAll().toStdString()); diff --git a/src/ProjectConfig.hpp b/src/ProjectConfig.hpp index 12bcc248..1f02af99 100644 --- a/src/ProjectConfig.hpp +++ b/src/ProjectConfig.hpp @@ -33,6 +33,9 @@ namespace Bloom /* * Initially, we used the JSON format for project configuration files, but this was changed in version 0.11.0. * See https://github.com/navnavnav/Bloom/issues/50 for more. + * + * Because JSON is a subset of YAML, we can (and do) fallback to bloom.json in the absence of bloom.yaml. + * See Application::loadProjectConfiguration() for more. */ /**