|
|
@ -29,10 +29,10 @@ function relativePath (path: string, sharedFolder: string): string { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function normalizePath (path: string): string { |
|
|
|
function normalizePath (path: string): string { |
|
|
|
|
|
|
|
if (path === '/') path = './' |
|
|
|
if (process.platform === 'win32') { |
|
|
|
if (process.platform === 'win32') { |
|
|
|
return path.replace(/\\/g, '/') |
|
|
|
return path.replace(/\\/g, '/') |
|
|
|
} |
|
|
|
} |
|
|
|
if (path === '/') path = './' |
|
|
|
|
|
|
|
return path |
|
|
|
return path |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -42,8 +42,15 @@ function walkSync (dir: string, filelist: Filelist, sharedFolder: string): Filel |
|
|
|
filelist = filelist || {} |
|
|
|
filelist = filelist || {} |
|
|
|
files.forEach(function (file) { |
|
|
|
files.forEach(function (file) { |
|
|
|
const subElement = pathModule.join(dir, file) |
|
|
|
const subElement = pathModule.join(dir, file) |
|
|
|
|
|
|
|
let isSymbolicLink |
|
|
|
|
|
|
|
|
|
|
|
if (!fs.lstatSync(subElement).isSymbolicLink()) { |
|
|
|
try { |
|
|
|
|
|
|
|
isSymbolicLink = !fs.lstatSync(subElement).isSymbolicLink() |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
isSymbolicLink = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isSymbolicLink) { |
|
|
|
if (fs.statSync(subElement).isDirectory()) { |
|
|
|
if (fs.statSync(subElement).isDirectory()) { |
|
|
|
filelist = walkSync(subElement, filelist, sharedFolder) |
|
|
|
filelist = walkSync(subElement, filelist, sharedFolder) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -62,8 +69,14 @@ function resolveDirectory (dir: string, sharedFolder: string): ResolveDirectory |
|
|
|
|
|
|
|
|
|
|
|
files.forEach(function (file) { |
|
|
|
files.forEach(function (file) { |
|
|
|
const subElement = pathModule.join(dir, file) |
|
|
|
const subElement = pathModule.join(dir, file) |
|
|
|
|
|
|
|
let isSymbolicLink |
|
|
|
|
|
|
|
|
|
|
|
if (!fs.lstatSync(subElement).isSymbolicLink()) { |
|
|
|
try { |
|
|
|
|
|
|
|
isSymbolicLink = !fs.lstatSync(subElement).isSymbolicLink() |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
isSymbolicLink = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isSymbolicLink) { |
|
|
|
const relative: string = relativePath(subElement, sharedFolder) |
|
|
|
const relative: string = relativePath(subElement, sharedFolder) |
|
|
|
|
|
|
|
|
|
|
|
ret[relative] = { isDirectory: fs.statSync(subElement).isDirectory() } |
|
|
|
ret[relative] = { isDirectory: fs.statSync(subElement).isDirectory() } |
|
|
|