diff --git a/CHANGELOG.md b/CHANGELOG.md index 92443487e..a96597bc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Unreleased +### Bug Fixes + +- Normalize all file paths on Windows, #2113. + ## v0.23.21 (2022-11-14) ### Features diff --git a/src/lib/converter/plugins/SourcePlugin.ts b/src/lib/converter/plugins/SourcePlugin.ts index dfaa7873e..7f1be97df 100644 --- a/src/lib/converter/plugins/SourcePlugin.ts +++ b/src/lib/converter/plugins/SourcePlugin.ts @@ -10,6 +10,7 @@ import { getCommonDirectory, normalizePath } from "../../utils/fs"; import { dirname, relative } from "path"; import { SourceReference } from "../../models"; import { gitIsInstalled, Repository } from "../utils/repository"; +import { BasePath } from "../utils/base-path"; /** * A handler that attaches source file information to reflections. @@ -77,7 +78,7 @@ export class SourcePlugin extends ConverterComponent { const symbol = reflection.project.getSymbolFromReflection(reflection); for (const node of symbol?.declarations || []) { const sourceFile = node.getSourceFile(); - const fileName = sourceFile.fileName; + const fileName = BasePath.normalize(sourceFile.fileName); this.fileNames.add(fileName); let position: ts.LineAndCharacter; @@ -115,7 +116,7 @@ export class SourcePlugin extends ConverterComponent { if (this.disableSources || !sig) return; const sourceFile = sig.getSourceFile(); - const fileName = sourceFile.fileName; + const fileName = BasePath.normalize(sourceFile.fileName); this.fileNames.add(fileName); const position = ts.getLineAndCharacterOfPosition( diff --git a/src/lib/converter/utils/base-path.ts b/src/lib/converter/utils/base-path.ts index d237fde38..d1bceaf8b 100644 --- a/src/lib/converter/utils/base-path.ts +++ b/src/lib/converter/utils/base-path.ts @@ -88,7 +88,7 @@ export class BasePath { // Remove all surrounding quotes path = path.replace(/^["']+|["']+$/g, ""); - // Make Windows drive letters lower case + // Make Windows drive letters upper case return path.replace(/^([^:]+):\//, (_m, m1) => m1.toUpperCase() + ":/"); } }