summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/glob/glob.js
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2014-08-07 16:33:35 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-08-07 16:33:35 -0700
commita5778cdf01425ae39cea80b62f9ec6740aec724a (patch)
tree6b011b6046ca68ee33e2cd811048f3e40558d7d9 /deps/npm/node_modules/glob/glob.js
parent28eee0adb7884e21217c99cbf10a681c7d91b64a (diff)
parentb0277f35bd86d441255dc5a4c19e577e03f03a47 (diff)
downloadandroid-node-v8-a5778cdf01425ae39cea80b62f9ec6740aec724a.tar.gz
android-node-v8-a5778cdf01425ae39cea80b62f9ec6740aec724a.tar.bz2
android-node-v8-a5778cdf01425ae39cea80b62f9ec6740aec724a.zip
Merge remote-tracking branch 'upstream/v0.10' into v0.12
Conflicts: ChangeLog Makefile deps/uv/ChangeLog deps/uv/build.mk deps/uv/src/unix/darwin.c deps/uv/src/unix/getaddrinfo.c deps/uv/src/version.c deps/v8/src/checks.h deps/v8/src/isolate.h lib/cluster.js lib/module.js lib/timers.js lib/tls.js src/node_version.h
Diffstat (limited to 'deps/npm/node_modules/glob/glob.js')
-rw-r--r--deps/npm/node_modules/glob/glob.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/deps/npm/node_modules/glob/glob.js b/deps/npm/node_modules/glob/glob.js
index f646c44838..36bbba84cf 100644
--- a/deps/npm/node_modules/glob/glob.js
+++ b/deps/npm/node_modules/glob/glob.js
@@ -36,14 +36,17 @@
module.exports = glob
-var fs = require("fs")
-, minimatch = require("minimatch")
+var fs
+try { fs = require("graceful-fs") } catch (e) { fs = require("fs") }
+
+var minimatch = require("minimatch")
, Minimatch = minimatch.Minimatch
, inherits = require("inherits")
, EE = require("events").EventEmitter
, path = require("path")
, isDir = {}
, assert = require("assert").ok
+, once = require("once")
function glob (pattern, options, cb) {
if (typeof options === "function") cb = options, options = {}
@@ -91,6 +94,7 @@ function Glob (pattern, options, cb) {
}
if (typeof cb === "function") {
+ cb = once(cb)
this.on("error", cb)
this.on("end", function (matches) {
cb(null, matches)
@@ -149,6 +153,10 @@ function Glob (pattern, options, cb) {
this.stat = !!options.stat
this.debug = !!options.debug || !!options.globDebug
+
+ if (/\bglob\b/.test(process.env.NODE_DEBUG || ''))
+ this.debug = true
+
if (this.debug)
this.log = console.error
@@ -176,6 +184,10 @@ function Glob (pattern, options, cb) {
// Keep them as a list so we can fill in when nonull is set.
this.matches = new Array(n)
+ if (this.minimatch.set.length === 0) {
+ return process.nextTick(this._finish.bind(this))
+ }
+
this.minimatch.set.forEach(iterator.bind(this))
function iterator (pattern, i, set) {
this._process(pattern, 0, i, function (er) {
@@ -429,9 +441,9 @@ Glob.prototype._process = function (pattern, depth, index, cb_) {
if (prefix === null) read = "."
else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
if (!prefix || !isAbsolute(prefix)) {
- prefix = path.join("/", prefix)
+ prefix = "/" + prefix
}
- read = prefix = path.resolve(prefix)
+ read = prefix
// if (process.platform === "win32")
// read = prefix = prefix.replace(/^[a-zA-Z]:|\\/g, "/")