Merge pull request #2144 from thelounge/xpaw/warn-config-folder

Warn about old config folder
This commit is contained in:
Jérémie Astori 2018-03-03 00:23:38 -05:00 committed by GitHub
commit f9f35fa498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -35,6 +35,8 @@ if (!fs.existsSync(path.join(
Helper.setHome(process.env.THELOUNGE_HOME || Utils.defaultHome()); Helper.setHome(process.env.THELOUNGE_HOME || Utils.defaultHome());
Utils.checkOldHome();
// Merge config key-values passed as CLI options into the main config // Merge config key-values passed as CLI options into the main config
_.merge(Helper.config, program.config); _.merge(Helper.config, program.config);

View File

@ -20,6 +20,23 @@ class Utils {
].forEach((e) => log.raw(e)); ].forEach((e) => log.raw(e));
} }
// TODO: Remove in a couple of releases
static checkOldHome() {
const currentHome = Helper.getHomePath();
const oldHome = currentHome.replace(/\.thelounge$/, ".lounge");
if (currentHome === oldHome || !fs.existsSync(oldHome)) {
return;
}
console.log(); // eslint-disable-line no-console
log.warn(`Folder ${colors.bold.red(oldHome)} still exists.`);
log.warn(`In v3, we renamed the default configuration folder to ${colors.bold.green(".thelounge")} for consistency.`);
log.warn(`You might want to rename the folder from ${colors.bold.red(".lounge")} to ${colors.bold.green(".thelounge")} to keep existing configuration.`);
log.warn("Make sure to look at the release notes to see other breaking changes.");
console.log(); // eslint-disable-line no-console
}
static defaultHome() { static defaultHome() {
if (home) { if (home) {
return home; return home;