From 85cc25cbd4dc2599554e9e8914a33b1a09a7e812 Mon Sep 17 00:00:00 2001 From: "Liao.Peng" Date: Tue, 9 Jul 2019 17:20:42 +0800 Subject: [PATCH 1/2] 1. Asc command supported absolute path. --- cli/asc.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/asc.js b/cli/asc.js index 72e1019e43..4a0dd0c9c2 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -380,6 +380,8 @@ exports.main = function main(argv, options, callback) { const filename = argv[i]; let sourcePath = String(filename).replace(/\\/g, "/").replace(/(\.ts|\/)$/, ""); + // Setting the path to relative path + sourcePath = sourcePath.indexOf(baseDir) == 0 ? sourcePath.slice(baseDir.length) : sourcePath; // Try entryPath.ts, then entryPath/index.ts let sourceText = readFile(sourcePath + ".ts", baseDir); From ab94853a23dbf33451f64c6ca631cc6cfad6eb3d Mon Sep 17 00:00:00 2001 From: "Liao.Peng" Date: Wed, 17 Jul 2019 10:19:07 +0800 Subject: [PATCH 2/2] 1. fix path outside baseDir Signed-off-by: Liao.Peng --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 4a0dd0c9c2..93808adecc 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -381,7 +381,7 @@ exports.main = function main(argv, options, callback) { let sourcePath = String(filename).replace(/\\/g, "/").replace(/(\.ts|\/)$/, ""); // Setting the path to relative path - sourcePath = sourcePath.indexOf(baseDir) == 0 ? sourcePath.slice(baseDir.length) : sourcePath; + sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath) : sourcePath; // Try entryPath.ts, then entryPath/index.ts let sourceText = readFile(sourcePath + ".ts", baseDir);