diff --git a/compiler/main.js b/compiler/main.js index 0ab8948..727304a 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -102,7 +102,8 @@ function loadEntryObj(projectConfig) { if (fs.existsSync(fileName)) { projectConfig.entryObj['./' + sourcePath] = fileName + '?entry'; } else { - throw Error(`\u001b[31m ERROR: page '${fileName}' does not exist. \u001b[39m`).message; + throw Error(`\u001b[31m ERROR: page '${fileName.replace(/\\/g, '/')}' does not exist. \u001b[39m`) + .message; } }); } else { @@ -150,7 +151,7 @@ function setEntryFile(projectConfig) { const entryFilePath = path.resolve(projectConfig.projectPath, entryFileRealPath); abilityConfig.abilityEntryFile = entryFilePath; if (!fs.existsSync(entryFilePath) && aceCompileMode === 'page') { - throw Error(`\u001b[31m ERROR: missing ${entryFilePath}. \u001b[39m`).message; + throw Error(`\u001b[31m ERROR: missing ${entryFilePath.replace(/\\/g, '/')}. \u001b[39m`).message; } projectConfig.entryObj[`./${entryFileName}`] = entryFilePath + '?entry'; } @@ -217,7 +218,9 @@ function setAbilityFile(projectConfig, abilityPages) { abilityConfig.projectAbilityPath.push(projectAbilityPath); projectConfig.entryObj[entryPageKey] = projectAbilityPath + '?entry'; } else { - throw Error(`\u001b[31m ERROR: srcEntrance file '${projectAbilityPath}' does not exist. \u001b[39m`).message; + throw Error( + `\u001b[31m ERROR: srcEntrance file '${projectAbilityPath.replace(/\\/g, '/')}' does not exist. \u001b[39m` + ).message; } }); } diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index a404124..707efdc 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -338,7 +338,7 @@ export class ResultStates { const position: string = errors[index].issue.location ? `:${errors[index].issue.location.start.line}:${errors[index].issue.location.start.column}` : ''; - const location: string = errors[index].issue.file + position; + const location: string = errors[index].issue.file.replace(/\\/g, '/') + position; const detail: string = errors[index].issue.message; logger.error(this.red, 'ETS:ERROR File: ' + location, this.reset); logger.error(this.red, detail, this.reset, '\n'); @@ -352,7 +352,7 @@ export class ResultStates { .replace(/\u001b\[.*?m/g, '').replace(/\.ets\.ts/g, '.ets').trim()}\n`; errorMessage = this.filterModuleError(errorMessage) .replace(/^ERROR in /, 'ETS:ERROR File: ').replace(/\s{6}TS/g, ' TS') - .replace(/\(([0-9]+),([0-9]+)\)/, ':$1:$2'); + .replace(/\(([0-9]+),([0-9]+)\)/, ':$1:$2').replace(/\\/g, '/'); this.printErrorMessage(errorMessage, false, errors[index]); } }