From 3ffc23c99ec588d71490dce9618358fc6e532a53 Mon Sep 17 00:00:00 2001 From: CEbbinghaus Date: Sun, 22 Sep 2024 15:08:35 +1000 Subject: [PATCH] Added copy support for non deck users --- util/build.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/util/build.mjs b/util/build.mjs index 193b159..f74016a 100644 --- a/util/build.mjs +++ b/util/build.mjs @@ -128,13 +128,15 @@ if (tasks.includes('collect')) { copyFileSync('package.json', 'build/package.json'); } -const is_local = existsSync('/home/deck/homebrew'); +const current_user = execSync("whoami").toString().trim(); + +const is_local = existsSync(`/home/${current_user}/homebrew`); if (is_local && tasks.includes('copy')) { Logger.Log('Copying build folder to local plugin directory'); - execSync(`sudo rm -rf /home/deck/homebrew/plugins/${PluginName}`); - execSync(`sudo cp -r build/ /home/deck/homebrew/plugins/${PluginName}`); - execSync(`sudo chmod 555 /home/deck/homebrew/plugins/${PluginName}`); + execSync(`sudo rm -rf /home/${current_user}/homebrew/plugins/${PluginName}`); + execSync(`sudo cp -r build/ /home/${current_user}/homebrew/plugins/${PluginName}`); + execSync(`sudo chmod 555 /home/${current_user}/homebrew/plugins/${PluginName}`); } else { if (!tasks.includes('copy')) { Logger.Log('Skipping copying build folder to local plugin directory');