to-absolute-glob
to-absolute-glob copied to clipboard
Cannot create linux glob paths on windows machine even when specifying root dir
On windows machines, the following code:
toAbsoluteGlob("**/*.txt", { cwd: "/", root: "/" }))
Will output the following:
C:/**/*.txt
Expected: /**/*.txt
I'm thinking that perhaps the following:
if (rootDir) {
rootDir = unixify(rootDir);
if (process.platform === 'win32' || !isAbsolute(rootDir)) {
rootDir = unixify(path.resolve(rootDir));
}
}
Should maybe be changed to?
if (rootDir) {
rootDir = unixify(rootDir);
if (!isAbsolute(rootDir)) {
rootDir = unixify(path.resolve(rootDir));
}
}
See my commit here. This might be considered a change of behaviour, but this allows for linux globs to be created on windows:
https://github.com/dsherret/to-absolute-glob/commit/7ca9987c8f2e96cc2f88dc32bade0df9b8806405
want to do a PR so we can review?
@jonschlinkert done. I opened #16.
There was one slight issue with it a day ago on the linux CI, but it's good now.