File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ var nodeModulesPaths = require('./node-modules-paths.js');
5
5
var normalizeOptions = require ( './normalize-options.js' ) ;
6
6
var isCore = require ( './is-core' ) ;
7
7
8
+ var realpath = typeof fs . realpath . native === 'function' ? fs . realpath . native : fs . realpath ;
9
+
8
10
var defaultIsFile = function isFile ( file , cb ) {
9
11
fs . stat ( file , function ( err , stat ) {
10
12
if ( ! err ) {
@@ -27,7 +29,7 @@ var defaultIsDir = function isDirectory(dir, cb) {
27
29
28
30
var maybeUnwrapSymlink = function maybeUnwrapSymlink ( x , opts , cb ) {
29
31
if ( ! opts || ! opts . preserveSymlinks ) {
30
- fs . realpath ( x , function ( realPathErr , realPath ) {
32
+ realpath ( x , function ( realPathErr , realPath ) {
31
33
if ( realPathErr && realPathErr . code !== 'ENOENT' ) cb ( realPathErr ) ;
32
34
else cb ( null , realPathErr ? x : realPath ) ;
33
35
} ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ var caller = require('./caller.js');
5
5
var nodeModulesPaths = require ( './node-modules-paths.js' ) ;
6
6
var normalizeOptions = require ( './normalize-options.js' ) ;
7
7
8
+ var realpath = typeof fs . realpathSync . native === 'function' ? fs . realpathSync . native : fs . realpathSync ;
9
+
8
10
var defaultIsFile = function isFile ( file ) {
9
11
try {
10
12
var stat = fs . statSync ( file ) ;
@@ -28,7 +30,7 @@ var defaultIsDir = function isDirectory(dir) {
28
30
var maybeUnwrapSymlink = function maybeUnwrapSymlink ( x , opts ) {
29
31
if ( ! opts || ! opts . preserveSymlinks ) {
30
32
try {
31
- return fs . realpathSync ( x ) ;
33
+ return realpath ( x ) ;
32
34
} catch ( realPathErr ) {
33
35
if ( realPathErr . code !== 'ENOENT' ) {
34
36
throw realPathErr ;
You can’t perform that action at this time.
0 commit comments