Skip to content

Commit 7b3abc6

Browse files
authored
Merge pull request #9213 from zhengbli/fixRealPath
ignore casing when converting a source file path to relative path
2 parents 4d5d152 + d9bd31f commit 7b3abc6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/compiler/utilities.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2330,7 +2330,9 @@ namespace ts {
23302330

23312331
export function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) {
23322332
let sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());
2333-
sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), "");
2333+
const commonSourceDirectory = host.getCommonSourceDirectory();
2334+
const isSourceFileInCommonSourceDirectory = host.getCanonicalFileName(sourceFilePath).indexOf(host.getCanonicalFileName(commonSourceDirectory)) === 0;
2335+
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
23342336
return combinePaths(newDirPath, sourceFilePath);
23352337
}
23362338

0 commit comments

Comments
 (0)