Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a function lists out directories not files on Windows 10 #61

Open
greghesp opened this issue Apr 21, 2018 · 4 comments
Open

Passing a function lists out directories not files on Windows 10 #61

greghesp opened this issue Apr 21, 2018 · 4 comments

Comments

@greghesp
Copy link

greghesp commented Apr 21, 2018

The below code appears to work correctly on OSX, however on Windows it seems to fail.

What I have noticed is that the ignoreFiles function is passed a list of top level subdirectories rather than a list of the files contained within them

getFiles(folder)
 .then(files => {
   console.log(files) // Equals []
 })

function getFiles(folder){
  return recursive(folder, ["*.DS_Store", ignoreFiles])
}

function ignoreFiles(file,stats){
  console.log(file) // Equals C:\Users\Greg\Dropbox\Designs\Valentines Day
  const slash = file.substr(file.lastIndexOf(`/`)+1),
        name = slash.toLowerCase(),
        fExt = name.substr(name.length - 4),
        hoodie = name.includes('hoodie');
  return fExt === '.png' && hoodie === false ? false : true
}
@jlanza
Copy link

jlanza commented Sep 4, 2018

I have a similar behaviour :( If I use a ignoreFile function in windows 10 I don't get the files from the subdirs, just from the root.

@ilmirons
Copy link

ilmirons commented Oct 4, 2018

I can confirm the problem reported by @jlanza, I'm running version 2.2.2 of package on windows 8. Perhaps something related with backslash folder separator?

@gtamas
Copy link

gtamas commented Jan 7, 2019

Happens on OSX too. I'm running 2.2.2 under 10.12.5

@crllrd
Copy link

crllrd commented Mar 1, 2019

2.2.2 ; OSX 10.13.6, same issue.

I suggest using the callback in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants