From 052248445c8cf79e417bf9ab3dcb12ccf523fa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Fri, 1 Dec 2017 01:33:04 -0500 Subject: [PATCH] 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. --- src/command-line/utils.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/command-line/utils.js b/src/command-line/utils.js index ec8ed1af..5ca3d4d1 100644 --- a/src/command-line/utils.js +++ b/src/command-line/utils.js @@ -23,12 +23,7 @@ class Utils { return home; } - const distConfig = path.resolve(path.join( - __dirname, - "..", - "..", - ".thelounge_home" - )); + let distConfig; // TODO: Remove this section when releasing The Lounge v3 const deprecatedDistConfig = path.resolve(path.join( @@ -39,9 +34,16 @@ class Utils { )); 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(`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();