File tree 1 file changed +8
-2
lines changed 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 9
9
/** Load other modules */
10
10
var _ = require ( '../lodash.js' ) ;
11
11
12
+ /** Used to indicate if running in Windows */
13
+ var isWindows = process . platform == 'win32' ;
14
+
12
15
/*--------------------------------------------------------------------------*/
13
16
14
17
/**
17
20
* @memberOf util.path
18
21
* @type String
19
22
*/
20
- var sep = path . sep || ( process . platform == 'win32' ? '\\' : '/' ) ;
23
+ var sep = path . sep || ( isWindows ? '\\' : '/' ) ;
21
24
22
25
/**
23
26
* The escaped path separator used for inclusion in RegExp strings.
27
30
*/
28
31
var sepEscaped = sep . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) ;
29
32
33
+ /** Used to determine if a path is prefixed with a drive letter, dot, or slash */
34
+ var rePrefixed = RegExp ( '^(?:' + ( isWindows ? '[a-zA-Z]:|' : '' ) + '\\.?)' + sepEscaped ) ;
35
+
30
36
/*--------------------------------------------------------------------------*/
31
37
32
38
/**
39
45
*/
40
46
function mkdirpSync ( dirname , mode ) {
41
47
// ensure relative paths are prefixed with `./`
42
- if ( ! RegExp ( '^\\.?' + sepEscaped ) . test ( dirname ) ) {
48
+ if ( ! rePrefixed . test ( dirname ) ) {
43
49
dirname = '.' + sep + dirname ;
44
50
}
45
51
dirname . split ( sep ) . reduce ( function ( currPath , segment ) {
You can’t perform that action at this time.
0 commit comments