diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 437cf8e05e..171f443910 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -311,9 +311,19 @@ namespace ts { return parseInt(process.version.charAt(1)) >= 4; } + function isFileSystemCaseSensitive(): boolean { + // win32\win64 are case insensitive platforms + if (platform === "win32" || platform === "win64") { + return false; + } + + const upperCaseFilename = _path.basename(__filename).toUpperCase(); + + return !fileExists(_path.join(_path.dirname(__filename), upperCaseFilename)); + } + const platform: string = _os.platform(); - // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive - const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + const useCaseSensitiveFileNames = isFileSystemCaseSensitive(); function readFile(fileName: string, encoding?: string): string { if (!fileExists(fileName)) {