@@ -13,7 +13,7 @@ function ownProp (obj, field) {
1313var fs = require ( "fs" )
1414var path = require ( "path" )
1515var minimatch = require ( "minimatch" )
16- var isAbsolute = require ( "path-is-absolute" )
16+ var isAbsolute = require ( "path" ) . isAbsolute
1717var Minimatch = minimatch . Minimatch
1818
1919function alphasort ( a , b ) {
@@ -88,24 +88,26 @@ function setopts (self, pattern, options) {
8888 self . changedCwd = false
8989 var cwd = process . cwd ( )
9090 if ( ! ownProp ( options , "cwd" ) )
91- self . cwd = cwd
91+ self . cwd = path . resolve ( cwd )
9292 else {
9393 self . cwd = path . resolve ( options . cwd )
9494 self . changedCwd = self . cwd !== cwd
9595 }
9696
9797 self . root = options . root || path . resolve ( self . cwd , "/" )
9898 self . root = path . resolve ( self . root )
99- if ( process . platform === "win32" )
100- self . root = self . root . replace ( / \\ / g, "/" )
10199
102100 // TODO: is an absolute `cwd` supposed to be resolved against `root`?
103101 // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
104102 self . cwdAbs = isAbsolute ( self . cwd ) ? self . cwd : makeAbs ( self , self . cwd )
105- if ( process . platform === "win32" )
106- self . cwdAbs = self . cwdAbs . replace ( / \\ / g, "/" )
107103 self . nomount = ! ! options . nomount
108104
105+ if ( process . platform === "win32" ) {
106+ self . root = self . root . replace ( / \\ / g, "/" )
107+ self . cwd = self . cwd . replace ( / \\ / g, "/" )
108+ self . cwdAbs = self . cwdAbs . replace ( / \\ / g, "/" )
109+ }
110+
109111 // disable comments and negation in Minimatch.
110112 // Note that they are not supported in Glob itself anyway.
111113 options . nonegate = true
0 commit comments