Giter Site home page Giter Site logo

Comments (8)

mrmlnc avatar mrmlnc commented on July 22, 2024 2

I prefer solution with is-glob with strict mode. In this case we needs have a separated tasks for static and dynamic patterns (just like the dynamic property in the ITask interface). Then, when processing a task, simply pass them to the correct adapters (fs and readdir-enhanced).

I've already started working on this issue.

from fast-glob.

mrmlnc avatar mrmlnc commented on July 22, 2024 1

Hello, @pvdlg,

Good catch! Yeap, this is due to the fact that we first try to read the directory, and then try to apply patterns.

So we need fix this behaviour. Thanks for reporting!

from fast-glob.

skarfacegc avatar skarfacegc commented on July 22, 2024 1

Would a check for file existence on each glob work?

const strippedGlobs = []
const results = [];
globs.forEach(glob =>{
  fs.access(glob, fs.constants.R_OK, err => {

    // file doesn't exist, add to the list of globs
    if(err){
      strippedGlobs.push(glob);
    } else {
      // file does exist, add to the result set
      results.push(glob);
    }
  })
})

from fast-glob.

mrmlnc avatar mrmlnc commented on July 22, 2024 1

Must be fixed by [email protected]. Please, read release notes for more details.

Thanks for reporting ❤️!

from fast-glob.

mrmlnc avatar mrmlnc commented on July 22, 2024

Just a few thoughts.

We can extract only constant patterns from all patterns, for example, using a is-glob package and run them as a separate task with different types (something like glob and regular). This requires changes in the task manager, creating adapters (glob, regular) and some magic in the base reader class. But this is first view.

from fast-glob.

mrmlnc avatar mrmlnc commented on July 22, 2024

@skarfacegc,

Yeap, good idea!

I think it's possible. Now the task manager doesn't know anything about the File System and i think he shouldn't know anything about it. We can create a new manager, provider or something and check whether the pattern exists on the file system. We need to think about how to solve this problem correctly.

I'll invest time to this issue in the near future.

from fast-glob.

skarfacegc avatar skarfacegc commented on July 22, 2024

If you can point me in the right direction I can take a look as well. I looked around but I couldn't wrap my head around how all the pieces fit together.

from fast-glob.

pvdlg avatar pvdlg commented on July 22, 2024

By checking for each string passed in the patterns wouldn't we loose performances for cases in which the pattern is an actual glob?

Passing a non glob path is still less common than passing a glob.
Maybe we should still use is-glob before testing on the FS.

from fast-glob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.