source: trip-planner-front/node_modules/isexe/windows.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 890 bytes
RevLine 
[6a3a178]1module.exports = isexe
2isexe.sync = sync
3
4var fs = require('fs')
5
6function checkPathExt (path, options) {
7 var pathext = options.pathExt !== undefined ?
8 options.pathExt : process.env.PATHEXT
9
10 if (!pathext) {
11 return true
12 }
13
14 pathext = pathext.split(';')
15 if (pathext.indexOf('') !== -1) {
16 return true
17 }
18 for (var i = 0; i < pathext.length; i++) {
19 var p = pathext[i].toLowerCase()
20 if (p && path.substr(-p.length).toLowerCase() === p) {
21 return true
22 }
23 }
24 return false
25}
26
27function checkStat (stat, path, options) {
28 if (!stat.isSymbolicLink() && !stat.isFile()) {
29 return false
30 }
31 return checkPathExt(path, options)
32}
33
34function isexe (path, options, cb) {
35 fs.stat(path, function (er, stat) {
36 cb(er, er ? false : checkStat(stat, path, options))
37 })
38}
39
40function sync (path, options) {
41 return checkStat(fs.statSync(path), path, options)
42}
Note: See TracBrowser for help on using the repository browser.