Skip to content

Commit

Permalink
Merge pull request #56 from arduino/bugfix/hide-symlink
Browse files Browse the repository at this point in the history
Bugfix/hide symlink
  • Loading branch information
murilopolese committed Jun 28, 2023
2 parents c6066fd + eacaa4f commit 4e890a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ function listFolder(folder) {
return files
}

function ilistFolder(folder, filesOnly) {
function ilistFolder(folder) {
let files = fs.readdirSync(path.resolve(folder))
files = files.filter(f => {
let filePath = path.resolve(folder, f)
return !fs.lstatSync(filePath).isSymbolicLink()
})
files = files.map(f => {
let filePath = path.resolve(folder, f)
return {
path: f,
type: fs.lstatSync(filePath).isDirectory() ? 'folder' : 'file'
}
})
// Filter out directories
if (filesOnly) {
files = files.filter(f => f.type === 'file')
}
// Filter out dot files
files = files.filter(f => f.path.indexOf('.') !== 0)
return files
Expand Down

0 comments on commit 4e890a6

Please sign in to comment.