Skip to content

Commit 36c95c0

Browse files
committed
Normalize all paths on Windows
Fixes #2113 Co-Authored-By: @royaltm
1 parent 8a3e195 commit 36c95c0

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
### Bug Fixes
4+
5+
- Normalize all file paths on Windows, #2113.
6+
37
## v0.23.21 (2022-11-14)
48

59
### Features

src/lib/converter/plugins/SourcePlugin.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { getCommonDirectory, normalizePath } from "../../utils/fs";
1010
import { dirname, relative } from "path";
1111
import { SourceReference } from "../../models";
1212
import { gitIsInstalled, Repository } from "../utils/repository";
13+
import { BasePath } from "../utils/base-path";
1314

1415
/**
1516
* A handler that attaches source file information to reflections.
@@ -77,7 +78,7 @@ export class SourcePlugin extends ConverterComponent {
7778
const symbol = reflection.project.getSymbolFromReflection(reflection);
7879
for (const node of symbol?.declarations || []) {
7980
const sourceFile = node.getSourceFile();
80-
const fileName = sourceFile.fileName;
81+
const fileName = BasePath.normalize(sourceFile.fileName);
8182
this.fileNames.add(fileName);
8283

8384
let position: ts.LineAndCharacter;
@@ -115,7 +116,7 @@ export class SourcePlugin extends ConverterComponent {
115116
if (this.disableSources || !sig) return;
116117

117118
const sourceFile = sig.getSourceFile();
118-
const fileName = sourceFile.fileName;
119+
const fileName = BasePath.normalize(sourceFile.fileName);
119120
this.fileNames.add(fileName);
120121

121122
const position = ts.getLineAndCharacterOfPosition(

src/lib/converter/utils/base-path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class BasePath {
8888
// Remove all surrounding quotes
8989
path = path.replace(/^["']+|["']+$/g, "");
9090

91-
// Make Windows drive letters lower case
91+
// Make Windows drive letters upper case
9292
return path.replace(/^([^:]+):\//, (_m, m1) => m1.toUpperCase() + ":/");
9393
}
9494
}

0 commit comments

Comments
 (0)