-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindows.js
More file actions
33 lines (25 loc) · 835 Bytes
/
Copy pathwindows.js
File metadata and controls
33 lines (25 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict'
const join = require('path').join
const ProductIterable = require('product-iterable')
const env = process.env
const keys = [...Object.keys(env), ...Object.getOwnPropertyNames(env)]
const getEnv = vname =>
env[keys.find(name => name.toUpperCase() === vname)] || ''
const allLeftNames = [
'UserProfile', 'AppData',
'ProgramFiles', 'ProgramFiles(x86)',
'ProgramFiles(x64)', 'ProgramW6432',
'HomeDrive'
].map(dir => getEnv(dir.toUpperCase()))
.filter(Boolean)
const allMidNames = [
'', 'nodejs',
'nodejs\\repl', 'npm'
]
const allRightNames = [
'atom-node-modules', 'atom-dev-node-modules', 'node_modules',
'.node_modules', '.node_libraries'
]
const allPaths = new ProductIterable(allLeftNames, allMidNames, allRightNames)
.map(path => join(...path))
module.exports = Object.freeze([...allPaths])