diff --git a/.travis.yml b/.travis.yml index 0324a02..dfbdac9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: node_js node_js: - "5.1" diff --git a/README.md b/README.md index f2662b9..6fcb4ff 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,10 @@ you want. `app-root-path` is aware of this edge-case and will strip the `/bin` a ## Change Log -### 1.1.0 +### 1.2.0 + - Special logic to resolve correctly when in an [electron](https://github.com/atom/electron) renderer process + +### 1.1.0 (currently `app-root-path@beta`) - Special logic to handle an edge case when used in a globally-installed CLI project - Fixed a bug where `setPath()` did not update `require('app-root-path').path` - Moved some logic outside of the `resolve()` function so that it's not called multiple times diff --git a/lib/resolve.js b/lib/resolve.js index 7411fe8..8a9e274 100644 --- a/lib/resolve.js +++ b/lib/resolve.js @@ -25,6 +25,11 @@ module.exports = function resolve(dirname) { return path.resolve(process.env.APP_ROOT_PATH); } + // Defer to main process in electron + if ('type' in process && 'renderer' === process.type) { + return require('remote').require('app-root-path').resolve(dirname); + } + var resolved = path.resolve(dirname); var alternateMethod = false; var appRootPath = null;