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

Platform independent way of referring to root? #592

Open
sageacy opened this issue Jun 27, 2024 · 1 comment
Open

Platform independent way of referring to root? #592

sageacy opened this issue Jun 27, 2024 · 1 comment

Comments

@sageacy
Copy link

sageacy commented Jun 27, 2024

I would like to refer to a root folder in my ignore globs in a platform independent way. I assumed that I could use the glob '/exclude/**' but unfortunately, that doesn't work on Windows.

On Windows, I need to use '//?/C:/exclude/**', I would prefer to use '/exclude/**' on both Windows and Linux.

What is odd is that include globs starting with '/' to refer to the root work fine on Windows, it only doesn't work for ignore globs.

Are there any GlobOptions I'm overlooking that will allow '/exclude/**' to work on Windows?

@isaacs
Copy link
Owner

isaacs commented Jun 27, 2024

Huh. Yeah, that is indeed weird shortcoming.

In the short term as a hacky workaround, you could implement your own IgnoreLike object to do whatever you want, but that's klunky af and not very well documented. It does work tho, and I'm relying on it in other places, so it's unlikely to break inside a major version.

Maybe minimatch needs a "matchRoot":true option or something, so that /x/* would match C:\x\y on windows.

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

2 participants