@@ -29,10 +29,10 @@ function relativePath (path: string, sharedFolder: string): string {
2929}
3030
3131function normalizePath ( path : string ) : string {
32+ if ( path === '/' ) path = './'
3233 if ( process . platform === 'win32' ) {
3334 return path . replace ( / \\ / g, '/' )
3435 }
35- if ( path === '/' ) path = './'
3636 return path
3737}
3838
@@ -42,8 +42,15 @@ function walkSync (dir: string, filelist: Filelist, sharedFolder: string): Filel
4242 filelist = filelist || { }
4343 files . forEach ( function ( file ) {
4444 const subElement = pathModule . join ( dir , file )
45+ let isSymbolicLink
4546
46- if ( ! fs . lstatSync ( subElement ) . isSymbolicLink ( ) ) {
47+ try {
48+ isSymbolicLink = ! fs . lstatSync ( subElement ) . isSymbolicLink ( )
49+ } catch ( error ) {
50+ isSymbolicLink = false
51+ }
52+
53+ if ( isSymbolicLink ) {
4754 if ( fs . statSync ( subElement ) . isDirectory ( ) ) {
4855 filelist = walkSync ( subElement , filelist , sharedFolder )
4956 } else {
@@ -62,8 +69,14 @@ function resolveDirectory (dir: string, sharedFolder: string): ResolveDirectory
6269
6370 files . forEach ( function ( file ) {
6471 const subElement = pathModule . join ( dir , file )
72+ let isSymbolicLink
6573
66- if ( ! fs . lstatSync ( subElement ) . isSymbolicLink ( ) ) {
74+ try {
75+ isSymbolicLink = ! fs . lstatSync ( subElement ) . isSymbolicLink ( )
76+ } catch ( error ) {
77+ isSymbolicLink = false
78+ }
79+ if ( isSymbolicLink ) {
6780 const relative : string = relativePath ( subElement , sharedFolder )
6881
6982 ret [ relative ] = { isDirectory : fs . statSync ( subElement ) . isDirectory ( ) }
0 commit comments