Skip to content

Commit

Permalink
bin: follow XDG OS conventions for storing data
Browse files Browse the repository at this point in the history
PR-URL: #1570
Fixes: #175
Fixes: #1124
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
Siilwyn authored and rvagg committed Apr 24, 2019
1 parent 8098ebd commit 8a83972
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Some additional resources for addons and writing `gyp` files:
| `--thin=yes` | Enable thin static libraries
| `--arch=$arch` | Set target architecture (e.g. ia32)
| `--tarball=$path` | Get headers from a local tarball
| `--devdir=$path` | SDK download directory (default is `~/.node-gyp`)
| `--devdir=$path` | SDK download directory (default is OS cache directory)
| `--ensure` | Don't reinstall headers if already present
| `--dist-url=$url` | Download header tarball from custom URL
| `--proxy=$url` | Set HTTP proxy for downloading header tarball
Expand Down
4 changes: 2 additions & 2 deletions bin/node-gyp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

process.title = 'node-gyp'

var envPaths = require('env-paths')
var gyp = require('../')
var log = require('npmlog')
var os = require('os')
var path = require('path')

/**
* Process and execute the selected commands.
Expand All @@ -20,7 +20,7 @@ var homeDir = os.homedir()
if (prog.devDir) {
prog.devDir = prog.devDir.replace(/^~/, homeDir)
} else if (homeDir) {
prog.devDir = path.resolve(homeDir, '.node-gyp')
prog.devDir = envPaths('node-gyp', { suffix: '' }).cache
} else {
throw new Error(
"node-gyp requires that the user's home directory is specified " +
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"bin": "./bin/node-gyp.js",
"main": "./lib/node-gyp.js",
"dependencies": {
"env-paths": "^1.0.0",
"glob": "^7.0.3",
"graceful-fs": "^4.1.2",
"mkdirp": "^0.5.0",
Expand Down

0 comments on commit 8a83972

Please sign in to comment.