Do not rename home file as it is very likely to have permission issues

On most systems (Linux at least), to install a npm package locally, one must use `sudo`. When The Lounge runs, it usually does not run with `sudo`. This causes the program to crash as user running The Lounge cannot create/delete files there.

We will let people manually convert this file instead of doing it for them. This file is mainly intended for package authors anyway, most users will never have to touch it.
This commit is contained in:
Jérémie Astori 2017-12-01 01:33:04 -05:00
parent 6dd568b27f
commit 052248445c
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8

View File

@ -23,12 +23,7 @@ class Utils {
return home; return home;
} }
const distConfig = path.resolve(path.join( let distConfig;
__dirname,
"..",
"..",
".thelounge_home"
));
// TODO: Remove this section when releasing The Lounge v3 // TODO: Remove this section when releasing The Lounge v3
const deprecatedDistConfig = path.resolve(path.join( const deprecatedDistConfig = path.resolve(path.join(
@ -39,9 +34,16 @@ class Utils {
)); ));
if (fs.existsSync(deprecatedDistConfig)) { if (fs.existsSync(deprecatedDistConfig)) {
log.warn(`${colors.green(".lounge_home")} is ${colors.bold("deprecated")} and will be ignored as of The Lounge v3.`); log.warn(`${colors.green(".lounge_home")} is ${colors.bold("deprecated")} and will be ignored as of The Lounge v3.`);
log.warn(`Renaming to ${colors.green(".thelounge_home")} instead.`); log.warn(`Use ${colors.green(".thelounge_home")} instead.`);
fs.renameSync(deprecatedDistConfig, distConfig); distConfig = deprecatedDistConfig;
} else {
distConfig = path.resolve(path.join(
__dirname,
"..",
"..",
".thelounge_home"
));
} }
home = fs.readFileSync(distConfig, "utf-8").trim(); home = fs.readFileSync(distConfig, "utf-8").trim();