mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Ignore missing symlinks in fsUtils.traverseTreeSync()
These were previously throwing an error from the call to statSync(). Now statSync() is wrapped in a try block and only performed when lstatSync() reports a symbolic link.
This commit is contained in:
@@ -147,13 +147,16 @@ module.exports =
|
||||
makeTree: (directoryPath) ->
|
||||
mkdirp.sync(directoryPath) if directoryPath and not @exists(directoryPath)
|
||||
|
||||
traverseTreeSync: (rootPath, onFile, onDirectory) ->
|
||||
traverseTreeSync: (rootPath, onFile, onDirectory=onFile) ->
|
||||
return unless @isDirectorySync(rootPath)
|
||||
|
||||
traverse = (directoryPath, onFile, onDirectory) ->
|
||||
for file in fs.readdirSync(directoryPath)
|
||||
childPath = path.join(directoryPath, file)
|
||||
stats = fs.statSync(childPath)
|
||||
stats = fs.lstatSync(childPath)
|
||||
if stats.isSymbolicLink()
|
||||
try
|
||||
stats = fs.statSync(childPath)
|
||||
if stats.isDirectory()
|
||||
traverse(childPath, onFile, onDirectory) if onDirectory(childPath)
|
||||
else if stats.isFile()
|
||||
|
||||
Reference in New Issue
Block a user