From 66b19677bf1e57455242b5e62ffcadee06b97eb6 Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Tue, 12 Mar 2019 13:10:00 +0100 Subject: [PATCH] Use APPDIR from env in the child writer Change-type: patch --- lib/gui/app/modules/image-writer.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/gui/app/modules/image-writer.js b/lib/gui/app/modules/image-writer.js index 18faecee..8d74f0c4 100644 --- a/lib/gui/app/modules/image-writer.js +++ b/lib/gui/app/modules/image-writer.js @@ -206,7 +206,7 @@ exports.performWrite = (image, drives, onProgress) => { }) const argv = _.attempt(() => { - const entryPoint = getApplicationEntryPoint() + let entryPoint = getApplicationEntryPoint() // AppImages run over FUSE, so the files inside the mount point // can only be accessed by the user that mounted the AppImage. @@ -214,18 +214,13 @@ exports.performWrite = (image, drives, onProgress) => { // mount-point, and as a workaround, we re-mount the original // AppImage as root. if (os.platform() === 'linux' && process.env.APPIMAGE && process.env.APPDIR) { + entryPoint = _.replace(entryPoint, process.env.APPDIR, '') return [ process.env.APPIMAGE, - - // Executing the AppImage with ELECTRON_RUN_AS_NODE opens - // the Node.js REPL without loading the default entry point. - // As a workaround, we can pass the path to the file we want - // to load, relative to the usr/ directory of the mounted - // AppImage. - _.replace(entryPoint, path.join(process.env.APPDIR, 'usr/'), '') + '-e', + `require(\`\${process.env.APPDIR}${entryPoint}\`)` ] } - return [ _.first(process.argv), entryPoint