Skip to content

Commit 40ab4c0

Browse files
committed
fix: support windows format path (#2262)
1 parent 618460c commit 40ab4c0

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

bin/asc.js

100644100755
File mode changed.

bin/asinit.js

100644100755
File mode changed.

cli/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -643,17 +643,18 @@ export async function main(argv, options) {
643643

644644
// Include entry files
645645
for (let i = 0, k = argv.length; i < k; ++i) {
646-
const filename = argv[i];
647-
let sourcePath = String(filename)
648-
.replace(/\\/g, "/")
649-
.replace(extension_re, "")
650-
.replace(/[\\/]$/, "");
646+
const filename = String(argv[i]);
651647

652648
// Setting the path to relative path
653-
sourcePath = path.isAbsolute(sourcePath)
654-
? path.relative(baseDir, sourcePath).replace(/\\/g, "/")
655-
: sourcePath;
649+
let sourcePath = path.isAbsolute(filename)
650+
? path.relative(baseDir, filename)
651+
: path.normalize(filename);
656652

653+
sourcePath = sourcePath
654+
.replace(/\\+/g, "/")
655+
.replace(extension_re, "")
656+
.replace(/[\\/]$/, "");
657+
657658
// Try entryPath.ext, then entryPath/index.ext
658659
let sourceText = await readFile(sourcePath + extension, baseDir);
659660
if (sourceText == null) {

0 commit comments

Comments
 (0)