Skip to content

Commit 0f947f7

Browse files
tylerjusflyIfycode
authored andcommitted
fix: conditionally fixed cleanup issue for windows
1 parent 57c94d2 commit 0f947f7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

dev/developer.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ const { chdir } = process;
66

77
// Dynamically get current the name of this file you are in, and its parent folder
88
const developerJsFileName = basename(__filename/*, extname(__filename)*/);
9-
const cleanupFolderPath = dirname(new URL(import.meta.url).pathname);
109

10+
const currentFileUrl = import.meta.url;
11+
12+
let newUrl;
13+
if (process.platform === "darwin" || process.platform === "linux") {
14+
newUrl = new URL(currentFileUrl).pathname;
15+
} else
16+
newUrl = new URL(currentFileUrl).pathname.substring(
17+
new URL(currentFileUrl).pathname.indexOf("/") + 1
18+
);
19+
20+
const cleanupFolderPath = dirname(newUrl);
1121
// Change directory into the dynamically gotten parent folder, then extract folder name from path
1222
chdir(cleanupFolderPath);
1323
const cleanupFolderName = basename(resolve());

0 commit comments

Comments
 (0)