Code Monkey home page Code Monkey logo

Comments (4)

tgrajewski avatar tgrajewski commented on July 1, 2024 1

I guess proper paths on Windows are nice default. My needs are more advanced I suppose. I think I will solve it on my end then, as adding more options and maintaining them adds unnecessary burden on the maintainers.

from node-glob.

isaacs avatar isaacs commented on July 1, 2024

As long as the posix: true option has been around, it's been the full UNC path.

This is actually better, since it prevents "path too long" errors in many cases. What is the use case where you want / as the path separator on windows, and full absolute paths, but can't have UNC paths?

from node-glob.

tgrajewski avatar tgrajewski commented on July 1, 2024

OK, actually I didn't used posix option previously in v8 because I didn't needed. I just tried it in v10 to get forward slashes in the results.

v8 returned results with forward slashes, which was nice, because results matched the pattern "formatting":

> glob.sync('c:/users/tomasz/projects/builder/*.js');
[
  'c:/users/tomasz/projects/builder/builder.js',
  'c:/users/tomasz/projects/builder/index.js'
]

And v10 returns "normalized" paths, which for me is inconvenient:

> glob.sync('c:/users/tomasz/projects/builder/*.js');
[
  'C:\\Users\\Tomasz\\Projects\\builder\\index.js',
  'C:\\Users\\Tomasz\\Projects\\builder\\builder.js'
]

My main use case is to be able to compare glob patterns with forward slashes in them with resulting paths. Often I calculate relative paths of files where the glob pattern starts. I have lot of patterns, all of them are somehow dynamic (concatenated from multiple parts).

So I guess this is more of a complain, but this library requires to use forward slashes in patterns and returns paths that don't match the glob pattern formatting slashes, which requires additional normalizing steps or stripping the UNC thing.

from node-glob.

isaacs avatar isaacs commented on July 1, 2024

Would it be more convenient to use { posix: true, relative: true }?

Returning paths with / on windows by default was a frequent complaint about older versions 😅 I'm not opposed to adding an option to strip the unc prefix, just trying to understand the reason for it.

from node-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.