An even more educational version of the Bandolier for Learn JS the Hard Way.
https://learnjsthehardway.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
556 B
21 lines
556 B
9 months ago
|
import fg from "fast-glob";
|
||
|
|
||
|
/*
|
||
|
Fixes some common problems with `fast-glob` on windows. It removes
|
||
|
leading "C:\" from paths and replaces all of the `\\` with `/`.
|
||
|
|
||
|
__BUG__: This obviously won't work if you're on a different drive than C:.
|
||
|
|
||
|
+ `path string` -- The path/glob pattern to use.
|
||
|
*/
|
||
|
export const glob = (path) => {
|
||
|
if(process.platform === "win32") {
|
||
|
// fast-glob doesn't understand \\ or C:\
|
||
|
const fixed_path = path.replace("C:","").replaceAll('\\', '/')
|
||
|
|
||
|
return fg.sync(fixed_path);
|
||
|
} else {
|
||
|
return fg.sync(path);
|
||
|
}
|
||
|
}
|