Skip to content

Commit

Permalink
Use always slash as join separator for patterns
Browse files Browse the repository at this point in the history
Fixes kevva#17.
  • Loading branch information
yhatt committed Jun 27, 2019
1 parent 12dedcf commit 0b2fa7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(

const getPath = (filepath, cwd) => {
const pth = filepath[0] === '!' ? filepath.slice(1) : filepath;
return path.isAbsolute(pth) ? pth : path.join(cwd, pth);
return path.isAbsolute(pth) ? pth : path.posix.join(cwd, pth);
};

const addExtensions = (file, extensions) => {
Expand All @@ -27,18 +27,18 @@ const getGlob = (dir, opts) => {
}

if (opts.files && opts.extensions) {
return opts.files.map(x => path.join(dir, addExtensions(x, opts.extensions)));
return opts.files.map(x => path.posix.join(dir, addExtensions(x, opts.extensions)));
}

if (opts.files) {
return opts.files.map(x => path.join(dir, `**/${x}`));
return opts.files.map(x => path.posix.join(dir, `**/${x}`));
}

if (opts.extensions) {
return [path.join(dir, `**/*.${getExtensions(opts.extensions)}`)];
return [path.posix.join(dir, `**/*.${getExtensions(opts.extensions)}`)];
}

return [path.join(dir, '**')];
return [path.posix.join(dir, '**')];
};

module.exports = (input, opts) => {
Expand Down

0 comments on commit 0b2fa7f

Please sign in to comment.