From fd856f816307a832403894a8758d0c0399a86cb0 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Mon, 10 Sep 2018 01:53:12 -0500 Subject: [PATCH] PKG_PATH, pkgPath --- cmd/cmd.js | 5 +++++ lib/core/fs.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/cmd/cmd.js b/cmd/cmd.js index f38513da..cb8ee450 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -20,6 +20,11 @@ if (!process.env.EMBARK_PATH) { process.env.EMBARK_PATH = utils.joinPath(__dirname, '..'); } +// set the anchor for embark's fs.pkgPath() +if (!process.env.PKG_PATH) { + process.env.PKG_PATH = process.env.PWD; +} + // NOTE: setting NODE_PATH at runtime won't effect lookup behavior in the // current process, but will take effect in child processes; this enables // lookup of *global* embark's own node_modules from within dapp scripts (such diff --git a/lib/core/fs.js b/lib/core/fs.js index 01a987dc..e596d094 100644 --- a/lib/core/fs.js +++ b/lib/core/fs.js @@ -106,6 +106,10 @@ function dappPath() { return anchoredPath('DAPP_PATH', ...arguments); } +function pkgPath() { + return anchoredPath('PKG_PATH', ...arguments); +} + function createWriteStream() { return fs.createWriteStream.apply(fs.createWriteStream, arguments); } @@ -156,6 +160,7 @@ module.exports = { removeSync, embarkPath, dappPath, + pkgPath, createWriteStream, tmpDir, copyPreserve