Skip to content

Commit

Permalink
Added ability to configure development dir [nodejs#21]
Browse files Browse the repository at this point in the history
- Allows users to specify development directory using '--dev-dir' flag
- Added check for XDG_CACHE_HOME before HOME
  • Loading branch information
Graham Losee committed Nov 26, 2014
1 parent d3583d7 commit 6089224
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/node-gyp.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ function Gyp () {
var self = this

// set the dir where node-gyp dev files get installed
// TODO: make this *more* configurable?
// see: https://github.com/TooTallNate/node-gyp/issues/21
var homeDir = process.env.HOME || process.env.USERPROFILE
// user can specify this using the `dev-dir` flag or any of
// the below environment variables. Addresses [#21].
var homeDir = this.opts['dev-dir'] || process.env.XDG_CACHE_HOME
|| process.env.HOME || process.env.USERPROFILE;
if (!homeDir) {
throw new Error(
"node-gyp requires that the user's home directory is specified " +
"in either of the environmental variables HOME or USERPROFILE"
"node-gyp requires that the user specify a development directory " +
"in either of the environmental variables XDG_CACHE_HOME, HOME, " +
"or USERPROFILE if the `dev-dir` flag is not used."
);
}
this.devDir = path.resolve(homeDir, '.node-gyp')
Expand Down

0 comments on commit 6089224

Please sign in to comment.