Skip to content

Commit 060f418

Browse files
committed
fix: automatic file loading on windows
1 parent da4e40d commit 060f418

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/nice-plants-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'jellycommands': patch
3+
---
4+
5+
fix automatic file loading on windows

packages/jellycommands/src/utils/files.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { totalist } from 'totalist';
2+
import { pathToFileURL } from 'url';
23

34
// Takes in file/folder paths and T and will resolve all to T
45
// When T is found callback is called
@@ -11,10 +12,13 @@ export async function read<T>(things: string | Array<string | T>, callback: (ite
1112
continue;
1213
}
1314

14-
await totalist(item, async (name, path) => {
15+
await totalist(item, async (name, rawPath) => {
1516
// If it starts with an _ we ignore it
1617
if (name.startsWith('_')) return;
1718

19+
// Windows needs a file url
20+
const { href: path } = pathToFileURL(rawPath);
21+
1822
// Import the file
1923
const data = await import(path);
2024

0 commit comments

Comments
 (0)